Refactor Header representation to not store the raw representation

This disallows reparsing, but since that can be a significant source of
errors I think this is actually beneficial.

This also refactors to avoid storing the TypeId, though that is less of a
gain.
I tried doing this, and it seemed that boxing it up messed with the typeid. That's why I used a downcast with no check, because the AnyRefExt downcast returns None.