don't cache invalid subsets when preloading hmt associations.

This is a follow up to https://github.com/rails/rails/commit/c5451777b038c5e48567f69256986ae42a2cde48

Backport #9252.

Conflicts:

	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/eager_test.rb

The preloader code on 3-2-stable is not based on relations but on option hashes.
I had to modify the original patch and comparing the option hashes could be more
fuzzy than comparing the relations. All the tests passed though.