The UnionNode plan node incorrectly sets the number of nodes based on its first child. An inaccurate number of nodes can lead to bad planning decisions, e.g. wrong join order or strategy.
A better policy would be to set the number of nodes based on the max nodes over all the union's children. That number might still underestimate the real number of nodes, but significantly less so.
Getting a more accurate estimate would involve keeping track of the actual list of hosts in all plan nodes. Let's focus on the simpler solution outlined above first.