src: consolidate environment cleanup queue
Each Realm tracks its own cleanup hooks and drains the hooks when it is going to be destroyed.
Moves the implementations of the cleanup queue to its own class so that
it can be used in node::Realm
too.
Refs: https://github.com/nodejs/node/pull/44348 Refs: https://github.com/nodejs/node/issues/42528