I've been using TB5-compatible magnetic USB adapters to switch between TB5 Macs. The keyboard, mouse, & hub all plug into my monitor.
I used the Sabrent TB4 KVM for a while. I had to give it up and use the magnetic USB hack when my new gear outpaced the KVP switch (i.e. TB5 == 5K HDR @ 120Hz).
If anyone here does try magnetic adapters, I highly recommend the 90° flat connectors, since they're far less prone to disconnect when you move the monitor.