Having the Undocking notification called from here, the other DockSequence activities, and from OreRefinery is asking for hard to debug edge cases where something isn't notified.

The harvester/refinery code is a huge mess that needs rethinking, but for now you could mostly avoid that by adding a method that the dock traits use to notify the refinery when they start/finish docking, and then have those do the notification. The internal refinery methods would then also call these when the harvester is undocked for other reasons.