There's a conflict between global undo and editmode undo. The first one reloads a .blend actually, so pointers change all over. The latter still uses the object pointers for checks. To resolve that the editmode undo system cleans its stack based on object names, not pointers. In previous code I tried something smart to prevent undo stacks being reused when you delete an object, and add new object with same name. That didn't go OK in all cases... so I accept this little quirk for now (rename object still works though, wont clean the undo stack)