Can't seem to reproduce it here - everything seem to work as expected:
https://e.var.nz/2022-10-01.factorio-switch-button.u4B02J.mp4
Note at the end of the video, when switch is disconnected, it doesn't look like it's being toggled, except in the panel on the right.
Are you trying to use the keyboard shortcut in the same way as in that video? Or maybe not, or expecting some different result?
If it doesn't work the same for you, then I think most likely issue is that event handling from some other mod interferes, not necessarily via shortcut key conflict, but maybe something else.
I'd suggest trying to quickly reproduce the issue in a New Game same as above, save it, then toggle all other mods temporarily off, load the game, see if that fixes the issue (it should), then toggle half of them back on, see if stuff breaks (indicating that one of the toggled mods is the issue), and repeat this half-on/off like 3 times, and you should end up with a single exact mod that causes this strange behavior.
Let me know which one it is, might want to fix the conflict here, if it is possible.