Once we support to add aggregation path during path consideration, we need to pay attention morphing of the final target-list according to the intermediate path combination, tentatively chosen. For example, if partial-aggregation makes sense from cost perspective; like SUM(NRows) of partial COUNT(*) AS NRows instead of COUNT(*) on billion rows, planner also has to adjust the final target-list according to the interim paths. In this case, final output shall be SUM(), instead of COUNT().
This sounds very much like what's been discussed here:
The basic concept is that we add another function set to aggregates that allow the combination of 2 states. For the case of MIN() and MAX() this will just be the same as the transfn. SUM() is similar for many types, more complex for others. I've quite likely just borrowed SUM(BIGINT)'s transfer functions to allow COUNT()'s to be combined.
More time does need spent inventing the new combining functions that don't currently exist, but that shouldn't matter as it can be done later.