Please see https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices
for more information.
ODBC 13 uses a different version of the runtime library, it is older and does not do thread-safe static initialisation. That may be why you don't see a deadlock. But the newer one does, so the atexit() handlers (which call global static destructors) are executed in a locked section. The main thread is waiting in a locked section for the secondary thread to exit, but the secondary thread is also waiting for that lock in order to run its uninitialisation.
This is all just a long explanation for why you should not be doing anything but trivial initialisation for global statics.