Also fixes a bug where zones meeting at a point would get merged
resulting in a self-intersecting zone.
Also fixes a bug where undo would not be handled correctly when zones
could not be merged.
Fixes https://gitlab.com/kicad/code/kicad/issues/10466
(cherry picked from commit d5a2059c21)