Impulse relay functionality without latching
A generic solution would be to use a PLC.if it is safety related, the you’d want a safety rated PLC.
You could probably do it ‘old skool’ by using a handful of relays, but this is not the place to ask for a design.