Index union sort hack
- [x] closes #17376
- [x] tests added / passed
- [x] passes `git diff master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

This is an attempt to adapt #17378 according to @gfyoung 's suggestions.

(I do plan to investigate more in depth the problem in Windows, I just won't be able to do it soon)
@toobaz : Just to confirm: does this supersede #17378 (i.e. should we close that?)

Curious to see if AppVeyor will be more accommodating to this PR. > @toobaz : Quick question: does this supersede #17378 (i.e. should we close that?)

... if this passes tests, I guess we will. > ...if this passes tests, I guess we will.

That's a good enough answer for me. 👍  closing as stale, if you want to continue working, pls ping and we can re-open. you will need to merge master.