Customize/override the 'UNDO' behaviour of a bpy.types.Operator?

When the undo/redo happens, the scene is first reset to a previous state. According to a discussion with RickyBlender of this thread and my testings.

So here is the next question:

Is it possible to customize or override the ‘UNDO’ behaviour of a bpy.types.Operator?

Edit: After a second thought… that wouldn’t be possible, and if possible the situation has to be specific… Simply deselecting the last object would fail the UNDO. Welp…