The planner can perform some aggregation before joins to reduce the number of rows to process. This is controlled by enable_eager_aggregate.
enable_eager_aggregate