Fixes #3309: Support deep merging of hash and array structures in smart class parameters

This relates to feature 3636 which states a couple of changes to the way `lookup_keys` work
I'm creating a PR to get comments of this part of the change and to see that I'm in the right direction
I had to use binding.pry to understand this method. Here are few ideas how to improve readability
* if you iterate over hash, use `hash.each do |key, value|` so you don't have to do `key_id = key[0]`
* try to find better names then `hash`, `key`, `name`, `value`, it helps to understand what these variables represent and this is not generic hash merge function it expects hash in specific format, maybe `matchers`, `lookup_key_id`, `lookup_key_name`, `lookup_key_value` or `lk_whatever` would help
* while `-1 * value[:index]` is nice "hack" but I'd still prefer `.sort_by {|h| [:index] }.reverse` even though it's probably slower or if we used OpenStruct we could just do `.sort_by(&:index).reverse`, however best would be to get matches in right order when we search them and do just merging here