817 metaclass refactor

Refactored most of the metaclass magic into a standalone TypeRegistry.

We still use metaclasses, principally to collect types defined at import time, but registered types and descriptors now all come from the type registry.

TypeRegistry instances are currently tied one-to-one to Storage instance. They should be pooled and shared once we get type synchonization in place.