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.
Merge pull request #10796 from neerajdotname/10669

flatten merged join_values before building the joins