async_hooks: only disable promise hook if wanted
The promise hook has been disabled asynchronously in order to solve issues when an async hook is disabled during a microtask.
This means that after scheduling the disable-promise-hook call, attempts to enable it synchronously will later be unintentionally overridden.
In order to solve this, make sure that the promise hooks are still no longer desired at the time at which we would disable them.
Fixes: https://github.com/nodejs/node/issues/27585
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines