Writing a minidump file involves attaching psapi.dll to the process.
This is a problem if the process is elsewhere holding the ntdll lock.
The lock ntdll!LdrpInvertedFunctionTableSRWLock protects DLL import tables.
This is being held by a thread while we are loading the psapi.dll library to create the minidump.
Attach psapi.dll at startup.
Generate the minidump with a separate process (which won't have its ntdll import table mutexes held).