If I understand your setup. I think you want to install a ‘smart switch’ in the wall to replace a ‘dumb’ momentary button. The issue is that the smart switch need to send a pulse square wave out the wires that go back to the sub panel when the switch is pressed. I seem to remember some of the Shelly devices may have this type function, but it has been a while since I worked with their products. Again, if I understand you, the switch needs power, probably from mains, however the wires that go back to the sub panel are passive and probably need to be isolated from mains in the switch. Below is a board I have experimented with that might be be able to do what I am describing above. It is far from ‘UL’ approved however. Good hunting!