ERR: add stacklevel to to_dict() UserWarning (#16927)
 - [x] closes #16927 
 - [ ] tests added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff`` (On Windows, ``git diff upstream/master -u -- "*.py" | flake8 --diff`` might work as an alternative.)
 - [x] The warning now correctly points to the calling site.

I would like some guidance on how to implement testing for this quick fix. I was thinking on using pytest's [warning assertion](https://docs.pytest.org/en/latest/warnings.html#warns), but couldn't figure out how to make it elegantly.

Cheers! :beers:
