When a \$lookup sub-pipeline contains \$searchMeta, the optimizer routes the \$lookup to the merger pipeline. It then appears only in splitPipeline.mergerPart, which getAggPlanStages does not search, causing "Expected at least one \$lookup stage" assertion failures in the mongot_e2e_sharded_collections suite.
Fall back to searching splitPipeline.mergerPart when getAggPlanStages returns empty. Also skip the nReturned check for merger-sourced stages, since mergerPart is always serialized at queryPlanner verbosity and execution stats are not tracked there.