SessionCatalogMigrationSource::_fetchNextNewWriteOplog() uses a DBDirectClient to do a query on the oplog. This is called after obtaining a lock as part of the AutoGetActiveCloner.
Attempting to read the oplog through the query system will end up calling waitForAllEarlierOplogWritesToBeVisible(). This will result in deadlocks sometimes, as there could be oplog writes that cannot become visible because they committed prior to some blocked uncommitted transaction that is blocked by the problematic code (thus completing the circle of deadlocks.)
The possible change _fetchNextNewWriteOplog() to not use a DBDirectClient.