"What we have heah, is a failure to communicate." - The Captain, Cool Hand Luke.
You're perfectly correct in questioning why Homer would say it is fitting to die for one's country, when the modern concept of the nation-state did not even exist at the time, however, you're wrong on one count, it was Horace a Latin poet, not Homer a Greek poet.
None the less, let's look at the quote in the question,
"Dulce et decorum est pro patria mori"
This has been translated over the years to mean:
"Sweet and fitting it is to die for one's country."
However, that's one interpretation. Latin to modern English does not often translate perfectly, just as German (one of English's closest linguistic relatives) doesn't always translate to English perfectly. Seriously, the Germans came up with Schadenfreude, a word which there is no literal translation into English other than "pleasure at the pain of others". One word into a whole phrase.
The reason that is, is that concepts vary by culture, time, and history.
In Horace's time, people associated themselves either with their polis or city-state such as Athens, or their cultural identity, homeland, or other affiliated group such as "Roman", "Punic", "Celtic", "Belgae", etc. For the Romans, the identity would be the civitas. Though this is mostly through a Latinized framework. (how these people's saw themselves are mostly lost to history)
In the case of Horace, the litteral translation of the word "patria" can mean "Fatherland", "Homeland", "One's own country", "Native Land," "Home City", or one of a dozen other possible similar meanings, all of which can roughly be equated to, "The place you consider your home, fellow people, and are loyal to."
So many more accurate translations based upon historical context and translation can be read as,
As with many texts, the true sense gets lost in translation. Since the rise of nationalism, the distinctiveness of certain ethnicities and cultures often gets lumped in with the term "nation" or "country," when what they really mean is "homogenous group of people" or "polity." This is usually for the sake of the audience, who can immediately connect with a term like "nation" but would have more trouble understanding something such as "polis" or "city-state" or "ethnic group." Take the Latin word "gens" for example. It can be translated as people, nation, tribe, or clan, but also means Gentiles. The plural "gentes" can also mean foreigners. Which one is used is up to the translator and based on context, grammar, and editorial preference. This is why many modern editions of ancient and medieval texts are parallel texts - the left page in the original language and the right page in a modern language. That way if there is a funky word like "gens," the reader can look at the translation and perhaps determine why the editor picked that particular translation. With a word like "country," if the reader disagrees with the translation, they can look to the original language and see if it's appropriate or not. A classical historian will be able to answer about Homer with more specific detail.
Check out the Loeb Classical Library, Oxford Medieval Texts, and the Clay Sanskrit Library for some fairly extensive volumes in parallel translation.
Hope this helps a little. Happy Reading!