The issue is that the mongo shell creates new _mongo variable every query (via setHiddenMongo) and this is the variable ends up being passed to _DelegatingDriverSession. Note that setHiddenMongo ends up creating new mongo variables because the connection the connection is actually a DBClientRS so runCommandWithTarget will return the connection to the primary. Thus, the comparison here will always fail. The variable also uses the same connection object, but since it is a new variable, it "forgets" everything about the connection, leaving the "authenticated" and "_defaulSession" variables undefined.
This means that when getDB is called, it will end up trying to authenticate on the same c++ connection, which in turn will try to get the default session. But since it is a new variable, it will not have the _defaultSession variable set and end up creating a new one on the same cpp connection.