has_many :through with dynamic condition merging

Fixes #16128.

This bug was introduced in rails@c35e438 so it's present in versions 4.1.2-rc1 and later.

rails@c35e438 adds handling for scope merging in `has_many :through` relations, but does *not* take into account the case where the scope is passed with an argument (ie. the current record).

To reproduce see https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
Done.