GH28301 check for non-unique index in stack_multi_columns
- [x] closes #28301
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

The old implementation used `arange` to generate codes for a non-multiindex, which ended up creating bad codes if the index was not unique.  The fix is just a straightforward factorize.
thanks @christopherzimmerman nice patch!