Flags overwhelmingly represent nations, groups considering themselves nations, that were nations or have some kind of individual governmental status.
Flags also represent causes, or groups that don’t aspire to becoming a nation.
They don't at all. Consider for example that every single city, county and local council in the UK has a flag. There are flags for the United Nations, the European Union, Esperanto, every major football team and most political movements including the CND and anarchism.
Nations != governments.
“Nations” as synonym for country started appearing only recently, in last two/three hundred years.
Flags have thousands of years of history.