REGR: DataFrameGroupBy.agg with duplicate column names and a dict
- [x] closes #55006 (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.

Unlike what I reported in #55006, the core issue is not how we treat kwargs. Rather, I believe the issue occurred in #52115 where logic specific for duplicate columns was added for Series/DataFrame but also impacted groupby.

This PR fixes the regression, but groupby still does not work with duplicate columns. I've confirmed groupby.agg does not work with duplicate columns in this case on 2.0.x, and believe it hasn't for a long time (possibly forever). For this, I've opened #55041.
Thanks @rhshadrach 