[mcs] Add nested types handling to check whether types unify for some type parameter substitutions. Fixes #17647