macOS: workaround a dyld/libunwind deadlock issue since 12.1
Apple reintroduced the old bug that we previously worked around in
fad04d39d592d8e0fcbfba439e8157f582bbc850 with a similar patch to this.
This is needed anywhere that we may attempt to stop threads.
Fixes #43578
(cherry picked from commit 2939272af2ef3fe9d8921f7ed0a6500e31a550c9)