BUG: .transform(...) with "first" and "last" fail when axis=1
Part of #45986 (first/last)

- [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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

This removes warnings of dropping nuisance columns when using e.g. `.transform("mean")`. This makes it consistent with `.agg`, and in #46072 both `transform` and `agg` will warn about the default switching from `numeric_only=False` to `numeric_only=True`. Doing this first will make #46072 slightly easier.

Not falling back to `_transform_item_by_item` is also better for performance. For the benchmark, I disabled the warning being emitted in main to make sure that wasn't messing up the results.

```
size = 1_000_000
df = pd.DataFrame(
    {
        "A": size * ["foo", "bar"],
        "B": "one",
        "C": np.random.randn(2*size),
        "D": np.random.randn(2*size),
    }
)
%timeit df.groupby("A").transform("mean")

# This PR
108 ms ± 966 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# main, but with size set to 100_000 (1mm was taking very very long)
920 ms ± 7.95 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```
thanks @rhshadrach 