I don't know the cause of the "undo" breakdown. I think it has to do with a certain sequence of actions or if the tool in use has an "undo" set.
Each tool tells the application that the file is being changed and it should be prepared to undo. There could be MANY instances of this in each tool depending on the action being done.
If there might be a step or two along the way, or a different tool is selected during a specific process that doesn't set the "undo" then that undo is lost. It could potentially break the whole chain.
It would require documenting every step that leads up to a loss of undos and looking at the code of each tool to determine where the undo is being lost.
You should be careful when relying on the undo in ANY application. They ALL have weird things. I even encountered undo breakdown in MS Word.
The best "workaround" is not to count on undo for 30 steps back. I certainly would hope that it works when i try this but I will not rely on it and will NOT complain if I can't undo 30 steps. That is a lot to expect from any application.
30 undos in any application for me is called
Revert to Saved.
-vern