SERVER-13033: Static Initalizer race condition with CreateDirectClient and server-side Javascript

(cherry picked from commit 7be64ae7568306dcbf75335a5e80793f4ce1268d)