nonmoving: Fix various data races found by ThreadSanitizer
Here we fix a number of data races spotted by ThreadSanitizer. For better or worse, there is nothing here that would be unsound on x86-64, although AArch64 is another story.
Based on !9372 (closed).
Edited by Ben Gamari