For a good list of countries, mostly derived from wikipedia as well, that comes with properties like dependency, disputed, and so on, includes historical data, back to 1970, and whose main purpose, similarly, is a set of flag icons, see OxJS:
https://oxjs.org/#doc/Ox.COUNTRIES
https://oxjs.org/#examples/countries/live
(The latter has a menu to show more than just current sovereign countries.)
Edited to add: In https://trac.oxjs.org/browser/oxjs/tools/geo you'll find the python toolchain to automatically generate the flag images.