REGR: prefer user-provided mode
follow-up to #39253

- [x] closes #39247
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

Make sure that the user-provided mode is always preferred (if it contains 't' or 'b') and extend list of text-only classes.
@twoertwein ping when ready here (merge master as well) I assume that the occasional errors in `test_server_and_default_headers` can be fixed with `pytest --dist=loadfile`? > I assume that the occasional errors in `test_server_and_default_headers` can be fixed with `pytest --dist=loadfile`?

yeah that makes sense. separate PR though thanks @twoertwein  @meeseeksdev backport 1.2.x Something went wrong ... Please have  a look at my logs. Perhaps I'm misusing the API, but this seems to have broken the ability to write gzipped JSON.  I haven't fully walked the code path, but here is what I'm seeing:

Reproduction:
```python
from io import BytesIO
import pandas as pd

dataframe = pd.DataFrame([1, 2, 3], columns=['a'])
object_stream = BytesIO()
dataframe.to_json(object_stream, compression='gzip', orient='records', lines=True)
```

Result:
```python
        if path_or_buf is not None:
            # apply compression and byte/text conversion
            with get_handle(
                path_or_buf, "wt", compression=compression, storage_options=storage_options
            ) as handles:
>               handles.handle.write(s)
E               TypeError: a bytes-like object is required, not 'str'

../../.env/lib/python3.7/site-packages/pandas/io/json/_json.py:105: TypeError
```

***

From what I can tell, _json's get_handle uses a static 'wt' mode which now, with the latest changes to common's _is_binary_mode, will always return false rather than check the path_or_buf instance type, thereby omitting the b flag on the mode passed to the rest of get_handle.

Is this expected behavior/am I misusing the Pandas API? Not the reproduction code works with Pandas 1.2.1

