This is not a bug. Undo is not controlled by 2D/physics and fundamentally it disables/enables the components in a GameObject.
In 2D physics, it has a feature that will produces Exit callbacks when a physics object is disabled/destroyed at runtime (in playmode). This is entirely expected behavior.
In 2D, this is controlled by the option: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Physics2D-callbacksOnDisable.html which also can be set in the physics settings.
If the user does not want this then they can simply disable this option.
3D physics does not have this feature and does not produce such a callback, but it is not a rationale to infer a bug for 2D physics