Thank you! I hadn't thought of using software to handle monitor switching.. I have a very similar setup but my monitor doesn't support usb upstream so I have a dumb usb hub with a button to switch sources then still have to manually use monitor input change.
You gave me the idea to setup scripts on the windows / macos system to 'react' to hub detach events (which I click the button) and execute cli commands to change the monitor source automatically to the other machine. Too good.