It is helpful to remember that in some way, defense mechanisms always pertain to the functioning of a personal boundary - either the outer one which connects us to the social world around us, or the inner, ego boundary which separates our unconscious instincts from our conscious mind and emotions. If we remember the visual depiction of a boundary, then we can always bypass the technical terms in which so much sounds alike.
Defense mechanisms, as “mechanisms,” appear to always be about the function of one or the other boundary and its status of holes, walls or doors. Further, when the defense is more immature and unconscious, it pertains more to the ego boundary function, and when more mature and conscious, more of the personal boundary comes into play. Except for one thing - the notion of looking out of a hole in the outer, personal boundary, even when we are conscious and paying attention - will still be outside our awareness as a matter of illusion (there is no boundary wall or door there to show us the limits.) Thus, the traditional confusion about what exactly ego defenses are, how they work, what boundaries are, and how they work. In the invisible world of psychology and the hidden world of the unconscious, everything happening can seem the same, even when we sense something is wrong with a relationship. Thus, the notion of, “I feel it in my gut. Something’s wrong, but I don’t know what.”
When you feel that way, it’s usually a boundary problem, and when it’s a boundary problem, it’s an immature, or at least dysfunctional defense mechanism problem. The more mature ones have parallels in the less mature ones. It’s just that the boundaries are even more underdeveloped and in disrepair.
Undoing is like that, in that it sounds so much like reaction formation in how it works. A person tries to 'undo' a destructive or conflicting, threatening thought by acting out the reverse of the unacceptable behavior.
Freud describes how reaction formation is the reversal of an idea, but undoing is the reversal of an actual behavior.
It is more than making amends, an apology for a wrong. It is an automatic attempt to reverse the social consequences of a social wrong, and you know it well. It is the guilty gift-giving of a man who buys flowers the day after he insults his partner, or the woman who gives the man a massage the day after embarrassing him in front of his family.
Undoing might be the defense being used by your partner whenever you notice something out of the ordinary that they do positive. For example, when you receive an unsolicited gift, then ask them, “What are you up to?” The reason for your suspicion, however light-hearted as it may be, is that the partner may have already done something you wouldn’t have approved of, but you pick up on this in their uncharacteristic positivity.
It is the classic, “I think you’re up to no good.”