Doesn't sound like linear undo/redo is the problem, but rather ability to navigate it. Timestamp the actions and you could offer "undo to 1h ago". Or you could allow searching the undo history.
But I may be having a hard time understanding why you need this as your description just does not fit my typical workflow.
But I may be having a hard time understanding why you need this as your description just does not fit my typical workflow.