REGR: Prevent indexes that aren't directly backed by numpy from entering libreduction code paths
- [X] closes #31223
- [X] closes #31248 
- [X] tests added / passed
- [X] passes `black pandas`
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

No whatsnew since this is a regression.
Okay, I've added back `Index._has_complex_internals` but modified it to also be `True` for `CategoricalIndex`, `IntervalIndex`, and `PeriodIndex` since those indexes require (potentially expensive) conversion to get a numpy array of values.  I don't want to exclude all extension indexes since `DatetimeIndex` and `TimedeltaIndex` don't require expensive conversion.

If adding back `Index._has_complex_internals` is acceptable, then I think we can also use it fix #31248 by using it to exclude things from `libreduction` in a similar manner.  Was planning to do it in a follow-up but can do it here too if we want. @jreback I think this is fixing a regression. We should leave it on the 1.0.0 milestone. Merged master to fix the CI failure. Added an additional check against `_has_complex_internals` that fixes #31248 and the associated test cases.

I don't immediately see any other areas where this check needs to occur but it's possible that there are additional cases. thanks Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
$ git checkout 1.0.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 82acdeef8790ba0e30b671a830f9efcfc17e8479
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am "Backport PR #31238: REGR: Prevent indexes that aren't directly backed by numpy from entering libreduction code paths"
```

4. Push to a named branch :

```
git push YOURFORK 1.0.x:auto-backport-of-pr-31238-on-1.0.x
```

5. Create a PR against branch 1.0.x, I would have named this PR:

> "Backport PR #31238 on branch 1.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                 @jschendel can you push a backport for this, didn't automatically work.