JVM is broken somehow.
I have the Esc key and Caps Lock key swapped via KDE settings. This makes my system think that Caps is Esc and Esc is Caps. This works 100% as intended everywhere on my system. It stops working in Minecraft versions 1.19 and above. I think it is a JVM issue, but I have no idea. Minecraft identifies the Caps key as Caps. Minecraft should be recognizing Caps as Esc because I set it up like that, but it won't do it.