MongoDB: is order guaranteed deep into the aggregation pipeline?
Your conclusion is correct: internal optimisations or implementation details may alter the order of results depending on the stage.

The $group stage is intentionally not order preserving, so you cannot rely on observational behaviour.

As noted in discussion on SERVER-24799: $group aggregation command should maintain document order in the MongoDB issue tracker:


  The reason the order is not preserved is that we keep track of all groups with a map from the _id to the accumulated value, so that we can quickly look up which group an incoming document belongs to.


As per Aggregation Pipeline Optimizations, some pipeline stages may also be coalesced or reordered to equivalent pipelines with improved performance. You can use the explain:true option to return information about how a pipeline will be executed.