Make sure that a joins Relation can be merged with has_many :through + association proxy
flatten merged join_values before building the joins

fixes #10669

While joining_values special treatment is given to string values.
By flattening the array it ensures that string values are detected
as strings and not arrays.