Protect against Ruby Hash regression

The fix for this mimics the fix that Rails uses to protect against the same regression: https://github.com/rails/rails/blob/5ad4c8df8dfe77e3e6cd0e6dce38be3a110e5819/activesupport/lib/active_support/hash_with_indifferent_access.rb#L235