TYP: Update typing for 3.10
- Ran `pyupgrade` so that typing is updated to python 3.10 - that modified files in `pandas/_libs`
- Updated `pandas/_typing.py` to have the following:
  - Use `TypeAlias` to declare all types
  - Change `Type` to use `builtins.type`
  - Remove `Optional`
  - Remove use of `Union` *except* for when it is used on a pandas type

Also fixed some other typing issues as well as an issue with running `stubtest` locally.

Thanks @Dr-Irv 