Prevent side effects in `Hash#with_indifferent_access`.

Fixes #10526 which was caused by 8c07696f470cff823ad0b538ca4bea1594742580

This patch takes a different approach to solve the problem addressed in 8c07696f470cff823ad0b538ca4bea1594742580 and makes sure that there are no side-effects when `Hash#with_indifferent_access` is called.

The `:for` option to `convert_value` feels a bit overloaded but it was the best thing that came to mind. Please let me know if you have a better idea.