I had a similar issue on multiple Intune-managed Windows 11 devices.
We already had general inbound casting rules deployed through Intune with the application set to Any.
The TCP rule allowed ports 7250, 7236-7240, 2869, 10243, and 5040.
The UDP rule allowed ports 5353, 1900, 7236-7240, and 3702.
Both rules applied to all firewall profiles and interface types. These rules had worked previously, but Miracast recently stopped connecting. The displays were still visible through Windows + K, and casting worked when Windows Defender Firewall was disabled.
A Windows Filtering Platform trace showed inbound TCP 7236 traffic for C:\Windows\System32\WUDFHost.exe being blocked by the default inbound rule.
I added the following Intune firewall rule:
Name: Miracast WUDFHost TCP 7236 Application: C:\Windows\System32\WUDFHost.exe Direction: Inbound Protocol: TCP Local port: 7236 Profiles: All Interface types: Any Action: Allow
After the rule applied, Miracast worked on four tested computers with Windows Defender Firewall enabled.
It is unclear why the broader rule with the application set to Any stopped working, but explicitly allowing WUDFHost.exe on TCP port 7236 resolved the issue.