threading: improve safety posture of modifying global bindings (#35761)
Ensures that we are holding some lock (a new one) while mutating the
internal global `jl_current_modules` table.
While reading these binding values is not memory-safe to do
simultaneously (it may invent pointers from thin-air and segfault), this
commit ensures that a data conflict during the writes to them will
not corrupt the values written into memory.