Editor: detect destroy object event when unloading scene

Is it possible to know in the Editor that OnDestroy() is triggered because the scene is closing?
IOW I want to differentiate it from the case when OnDestroy() is triggered due to removing an object from the scene.

I tried to subscribe to EditorSceneManager.sceneClosing to set a flag and then use it in OnDestroy() but this event didn’t work.

I am using both EditorSceneManager.sceneClosing and EditorSceneManager.sceneClosed and it works.

The order of events is:
sceneClosing

OnDestroy
OnDestroy

sceneClosed