BUG: fix indexing.py to make a copy of the indices (#20852)
- [x] closes #20852 
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

WIP. Reviewing the test cases and would add a test case to validate this fix. 