https://bugs.winehq.org/show_bug.cgi?id=53032
--- Comment #29 from Kevin Puetz PuetzKevinA@JohnDeere.com --- looks like doing this was originally inside __wine_dll_main, (in 5ea0dd6d5f2b085574e8d69a90200669461b2a4b), rather than the ELF __attribute__((destructor)) where it moved (in d4098549bb126e1711d91dbf2d2d9a610967c127).
That would not would not have had the TEB use-after-free, but would still have had the problems of being a recursive FreeLibrary call (free_lib_count existed even way back then)
So that doesn't give any real hints either on why wine tries to unload when windows seemingly doesn't, other than it hasn't just always been that way - delayloading was added in 2000 (5e32d1662867e41aae8b3748f7ee375644e4766a), and code to free them came ~4.5 years later.