Further improve match statement narrowing against unions (#20744)
I realised there is a simpler and more complete approach than the one
taken in #19600.
This adds the new "Step 2" to the original code. Best way to review the
diff is probably to check it out and review it squashed with #19600 ,
but really the net logic change is just "Step 2"
Fixes #15190
Fixes #17549
Fixes #17600
Mostly fixes #18039
Helps with things in #19081