TYP: misc return types
xref #47521

Most changes are from renaming `T` to `_<class>T`.
`typing_extensions` has just been merged into main in #51480. So you can update this  to use `from _typing import Self` instead of using `typevar`. Thanks @twoertwein 