When setShardVersion is initializing the global sharding state it does so while holding an exclusive lock: https://github.com/mongodb/mongo/blob/master/src/mongo/db/s/set_shard_version_command.cpp#L361
ShardingState initialization, however, can perform network traffic. Holding the exclusive lock while performing network traffic is a bad idea for several reasons, including that it can block stepdown and promotion to primary.
We should figure out why it's holding the global lock at all, and if there's no need we should remove it.