Fix pivot index bug
Previously, the variable "cols" was created solely to concatenate
the lists "index" and "columns" when the "values" parameter was
left as None.  It did so in a way that it modified the variable
passed as "index" using list.extend(), affecting the caller's
namespace.

This change simply uses an anonymous list in place of the
variable "cols"

Had some trouble setting up the dev environment to build pandas from source,
so no tests checked or docs built.  However, it's fairly minor change, so hoping 
that it builds green regardless...

- [X] closes #37635 
- [X] tests added / passed
- [X] passes `black pandas`
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry
