Make sure that a joins Relation can be merged with has_many :through + association proxy

Closes #11248.