Both "show changes" while editing, and the diff page between revisions, show diff lines in wrong order -- I guess when there are many consecutive lines changed. The source of the page is fine before and during/after the edit, only the generated diff (preview/page) is somewhat messed up.
I created a test page on test.wikipedia.org (same result as on active wiki, also mw version 1.32.0-wmf.10) and checked with different browsers/systems, logged in as well as logged out, to be sure it wasn't something on user's end (like broken user scripts). See this test page diff and its mobile inline version (and the screenshots). Most lines with a country template show up at the bottom of the diff, while they are the first cell of each table row, as can also be seen in the page's source.
Screenshots: