[CLN] More cython cleanups, with bonus type annotations
A few places where string formatting is modernized

Removed remaining `# cython: profile=False` comments

The main (and possible controversial) thing done here is changing some functions to use type-hint syntax.  The affected functions are all currently `cpdef`, but are never used in cython, so _should_ only be `def`.  But cython's syntax does not allow for specifying a return type in `def` functions, so this is the cleanest way to remove unnecessary `cpdef` without losing typing.  (some discussion of this occurred in #22180)