Flags overwhelmingly represent nations, groups considering themselves nations, that were nations or have some kind of individual governmental status.
“Nations” as synonym for country started appearing only recently, in last two/three hundred years.
Flags have thousands of years of history.