REF: Move part of groupby.agg to apply
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them

pre-commit adjusted to account for the false positive on `Union[SeriesGroupBy, DataFrameGroupBy]`.

Moves part of groupby.agg implementation from `pandas.core.aggregation` to `pandas.core.apply`. The only difference in the code is that in `apply`, the error message raised is different when the argument is a string (e.g. "sum") and the kwarg axis=1 is provided. Added a test to check for error message.

After this will be resample and rolling, then much of the implementation code in core.aggregation code can be moved into apply.
thanks @rhshadrach 