Cursors opened against sharded collections will contain a pointer to the CollectionMetadata, which corresponds to the version of the collection they are using and also a "lease" on that metadata so the range deleter will not clean it up while the cursor is still active.
The stepdown code, however, indiscriminately clears the CollectionShardingState map and as a result these queries no longer reference a valid CollectionMetadata object.
Instead of clearing the map, the stepdown code should just mark the collections as not sharded.