Use class name as namespace for type variables (#12590)
This avoids confusion between type variables of two classes, which can
happen at least in some edge cases. Type variables are only the same if
both the numeric id and namespace match (plus meta level).
Fixes #12588 (though the textual presentation of type variables doesn't
take the namespace into consideration yet).