Respect dtype when calling pivot_table with margins=True
 - [x] closes #17013
 - [x] tests added / passed
 - [x] passes ``git diff master -u -- "*.py" | flake8 --diff``
 - [x] whatsnew entry

This fix actually exposed an occurrence of #17035 in an existing test (as well as in one I added).