ENH: Improve ref-tracking for group keys
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [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
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

cc @jorisvandenbossche 

Follow-up on https://github.com/pandas-dev/pandas/pull/49450

The equals check causes failures in Dask. I think we are better off moving to reference checking anyway. If you are ok with the general logic here, I'd refactor this check down to the Manager level.
This would make `df.groupy(df['a'])` behave differently from `df.groupby(df['a'].copy())`, is that right? In general I'd like to move away from "in-axis" vs "out-axis" groupers behaving differently (ref: #49519), so I agree this is the right direction, but it might cause some odd edge cases to behave differently until we resolve those issues.

Still - I'm +0 here; checking equality gives some odd behaviors as well. Yes those 2 behave different, but this pr establishes the same behavior as in the non-cow mode for this case. So that's actually a plus imo Yes, I think this is a good solution for now (essentially the same as what was suggested in https://github.com/pandas-dev/pandas/pull/50730). And it indeed aligns with the behaviour we have for non-CoW.

Longer term, I agree with @rhshadrach that the current semantics are not really great. We should probably at some point move to not doing such check at all, at which point this discussion about identity vs equality also just doesn't matter anymore?
 Yep this sounds sensible, but I think this needs a deprecation cycle?

I’ll move the check to the BlockManager then Implemented it on the manager level Thanks!