PERF: Break reference cycle for all Index types
- [x] xref #27585 & #27607
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Generalizes the test in #27607 to be used for all index types. This finds ref cycle issues for ``PeriodIndex`` and ``CategoricalIndex`` which are solved in this PR.

Thanks for providing this extended fix :) I think this should be ok to pull in after the rebase?
 Agreed, thanks!