Until SERVER-61507 is complete, any CanonicalQuery that has a pushed down $group/$lookup should use the classic canonical query encoding. However, this is currently not the case. When constructing a slot based executor and generating a plan cache key, we encode the shape of the CanonicalQuery. However, when determining whether to generate an SBE or a classic key, we do not consider whether the canonical query has a non empty pipeline. That is, we can have an SBE compatible CanonicalQuery, but incorrectly use the SBE encoding because we have a set of pushed down $group/$lookup stages. This ticket should modify CanonicalQuery::encodeKey to consider whether we have any pushed down stages when determining which encoding to use.