Fix narrowing of nested union of TypedDicts (#11204)
The code in refine_parent_types() bailed out when it encountered
something other than a TypedDict in the union, including a nested union
of TypedDicts. This caused the narrowing to fail.
Fix it by making it iterate over the flattened union items.
Fixes #9308.