This is the same bug that is discussed here:
Automation Gets Stuck in Write Position - Cubase - Steinberg Forums
Not everyone mentions the undo getting lost, but it’s always lost for me when the automation bug pops up.
Please help confirm a theory by checking to see if the bug pops up on the second session opened of the day (without restarting Cubase in between)