When a rename collection between different dbs is received by the (potential) primary shard of the source collection, a best effort check is executed before spawning the coordinator to make sure that both databases reside on the same shard (it's not allowed to rename collections between dbs with a different primary shard).
The check relies on cached info that may be stale, so the rename may fail even when both dbs reside on the same primary.
Solution 1
Change this check in order to refresh. The advantage is that rename operations can prematurely fail without serializing on the DDL lock when the dbs reside on different primary shards.
Solution 2
Simply get rid of the check because the same check is performed after spawning the coordinator when it is ensured the primary shard for the source db can't change.