I've been told that it is problematic and even a-historical to talk of nations before the modern era, but why is that, exactly?
Today people often conflate "nation" with "state" or "people" but it means a very specific thing. A "nation" is a categorization of people that appeals to a sense of shared culture, language, and history. It transcends specific political regimes, and is a different category than, say, ethnic group, race, religion, ideology, or other categories that have often been appealed to as other modes of organizing and rallying people. So "the French" is something that transcends the specific politics of whomever is in power and whatever system of governance is in place — it's more than just the language (otherwise it would include the Belgians and colonized peoples), it's more than just ethnicity (there are many ethnicities within "the French"), it's more than just a sense of race (because the French people may be the same race as a bunch of other nations). It's an idea that says, "there's people who are sort of geographically located, but moreover are sharing a sense of identity and history that is kind of a mishmash of a bunch of overlapping categories." That's a "nation" and as you can see it is a tricky concept, a construction of ideas and often quite imagined heritage.
So when we talk about the emergence of nationalism it is not the same thing as saying the emergence of patriotism or militarism or anything like that. It's when, in very specific contexts, people started saying, "hey, people in X category — we're all in the same boat and should unite together politically!" Which is to say, it was coupled with the idea of the nation-state, which is to say, the idea that people of a shared culture/language/history should be ruled under the same political entity (and not either fractured into tinier categories, or ruled by some other "nation").
So in the case of Germany and Italy this is very easy to see what that means. Both were fractured areas with many politically small units. The people who worked to unify them appealed to a shared "nationality" (they were "Germans," not Saxons, Bavarians, Prussians; they were "Italians," not Tuscans, Neopolitans, Sicilians).
Nation is a very tricky category. Benedict Anderson famously describes them as "imagined communities"; they are appeals to commonalities and shared qualities that are at the very least disputable, sometimes entirely fanciful, and these particular properties (language, culture, sense of history) are extremely malleable (they can change from one generation to the next very easily). It is a category to be interrogated rather than blindly used or internalized.
Anyway. This is largely why the idea is tricky. The idea of the nation emerged in a very specific time and place and to support very specific kinds of political claims. To apply it willy-nilly throughout history and geography is questionable, just like applying the concept of "race" would be (the modern conception of "race" does not really emerge until the early modern period, so applying it much earlier than that creates a lot of historical error).