Bugfix for `encode_with_override` psych extension

The `coder` passed to ActiveRecord::Base#encode_with does not necessarily have
a `tag=` method (it may just be a Hash). This causes issues with other callers,
eg https://github.com/Shopify/identity_cache/blob/master/lib/identity_cache/query_api.rb#L140