[mypyc] Refactor: extract class-related genops to a new module (#8407)
Also extract some utilities.
This mostly preserves the original structure of the code, even though it's
not optimal after extraction. This is something I plan to clean up later.
This introduces an import cycle that I will fix in a later PR.