Virtual Pins are a tool for the App/sketch coding… GPIO and associated commands will always be required for the device side.
Now, if you are introducing a hardware based flip-flop in your wiring, then you need to add in some form of hardware based active circuit detection and use that to provide feedback to your sketch so that it can properly update the virtual pins.