[runtime] Improve thread dumping reliability by doing it while holding the fat locks.

We take the loader and the root domain locks before doing a thread dump. This reduces the odds
of us suspending a thread that holds either of them and deadlocking, for example, while decoding
AOT JIs.