Limit pneumatic cylinder stroke
This sounds like a control problem with very discrete states and well-defined transition between these states of operation.
That's what microcontrollers are for. Sounds like you buy one of the hundreds of cheap eval boards that come with examples (in C, or micropython or shudders even arduino) and writer 10 lines of code instead of designing complex timer boards.