There's no wall at the South Pole, so dragging a country across should just make it come back on the other side. That's actually what's happening here, except that the color ends up on the wrong side of the outline.
My guess is that the drawing code tries to correct the orientation of its input to avoid drawing shapes inside-out, which fails when the outline stretches across the full width of the map.