Fixing a regression when deserializing both Configuration and ClassHierarchy

#190 introduced a regression: When deserializing a `Configuration`, it erroneously assumed that the `ClassHierarchy` used by a `ConfigurationBuilderImpl` is always of instance type `ClassHierarchyImpl`. However, this isn't the case when the `ClassHierarchy` has been deserialized, in which case it is of instance type `ProtocolBufferClassHierarchy`. This causes a `ClassCastException` at runtime.

This PR wraps the offending code in an `instanceof` check and also adds tests for this case.