Don't query the database schema when calling `serialize`

We need to decorate the types lazily. This is extracted to a separate
API, as there are other refactorings that will be able to make use of
it, and to allow unit testing the finer points more granularly.
No the whole point is to avoid mutation so we don't modify parent classes.