SERVER-8786 Backport stability fixes to sharding/authConnectionHook.js