BUG/ENH: to_pickle/read_pickle support compression for file ojects
- [x] closes #26237, closes #29054, and closes #29570
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

This was basically already supported but `to/read_pickle` set `compression` to `None` for file objects.

Some functions called `get_filepath_or_buffer` (might convert a string to a file object) before calling `infer_compression` (doesn't work with file objects). I moved `infer_compression` and `get_compression_method` inside `get_filepath_or_buffer`.
@jreback ping very nice @twoertwein keep em coming!