Always insert hash-mapped types as objects

While implementing this, I came across an underlying issue in #467, which is also included in the PR.