PERF: groupby returns a RangeIndex from groups when possible
Discovered in #57441
I think https://github.com/pandas-dev/pandas/pull/58143 is a more generic application that affects this so closing in favor of that PR