BUG: groupby.agg doesn't include grouping columns in result when selected
- [x] closes #51186 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Potential follow-up that this makes possible: _iterate_slices is only used in _python_agg_general, where it iterates over columns calling agg_series.  agg_series iterates over groups.  Instead we could iterate differently over groups, which would look a lot like _aggregate_frame. Assuming no objection, going to merge when greenish. Currently targeted at 2.1.