PERF: Performance improvement in to_csv with unused levels in multiindex
- [x] closes #37484
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit) for how to run them
- [x] whatsnew entry

```
before 1.97 s ± 102 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
after 39.6 ms ± 3.1 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
```
wow!