Despite intending to prevent commands that extend it from running on sharded collections, NotAllowedOnShardedCollectionCmd can run concurrently (i.e. race) with shardCollection.
To counter this, it should take the same (dist)lock as shardCollection.
Particularly, this will prevent convertToCapped (which, notably, changes the collection's UUID because it uses cloneCollectionAsCapped (which creates a cloned collection with a different UUID) + renameCollection under the hood) and group from running on sharded collections.