[runtime] Add a workaround for #50529 by locking around pthread_create()/pthread_join...