Fix nested unions not casting correctly

This also includes a compile time option to check that value types align with row types. There's still a few tests in PostgresServerMiscYamlIT that fail if you enable this, but I'll fix those issues independently. 

In addition, I noticed a few places where a value was passed into a method, and the value of value.getType(), removed the second parameter in these instances. 

I also did two cleanups related to unions:
1. Don't cast a type to the same type
2. If something is cast to `<unknown>`, replace the cast, don't add a cast around that.