Make HashMap::take not corrupt the map. Fixes #19292
fixup
fixup
fixup
fixup
fixup