How to build a programmable sticky button
Someone has already invented this.

The circuit breakers used to simulate aircraft breakers in flight simulators can be released by a small current, but they are not cheap.



The device pictured sells for hundreds of dollars. I see a relay mechanism used like a firearm sear, some contacts, and a spring-loaded plunger - you may be able to duplicate this at a lower cost