Porting MinGW multithreading bugfix to makefile.mingw

Original fix:
https://github.com/bitcoin/bitcoin/commit/8864019f6d88b13d3442843d9e6ebeb8dd938831