Replace inefficient doc-to-hash function

Use the `create` method build into PersistentArrayMap make this
2-3x faster

There's another commit in here I thought would have been in core, but it probably got missed by some direct push shenanigans. In any case it's already in prod.