Sabrent has a Thunderbolt 4 KVM switch.
I don't know if it would work, but by the time you bought this switch and a couple of Thunderbolt cables (you would need Thunderbolt cables – not just plain USB-C ones – to go between it and the computers), you would have spent a fairly large amount of money.
Also there is a note on the Sabret site warning that if you connect the switch to non-Thunderbolt-certified devices, permanent damage may result. I don't know why they are saying "permanent damage" as opposed to "nothing will happen" … that makes me a bit nervous.