Disabling UDP on the gateway doesn't work.
From what I understand, mstsc.exe's normal behavior is to connect via UDP first. If that times out, it will then connect via TCP.
It seems like mstsc.exe Version 22621 is failing to timeout during the UDP connection attempt and then freezes. Once it freezes, you have to use Task Manager to end the process, as clicking the "X" won't close the program.
In other words, the RD Gateway's UDP settings are irrelevant when it comes to this issue.
The only two workarounds to this problem are to use the registry setting to disable UDP (that causes mstsc.exe to skip the whole UDP connection process and go straight to TCP) or copy the mstsc.exe and mstscax.dll files from a computer running Windows 11 21H2 to your updated 22H2 machine, overwriting the existing files (will need to take ownership first).
(use the latter fix if you really need UDP)