I wouldn't call Germany or Italy invented, they were re-united and to some extend managed to become more than a geographic term and a nation state again, before that they were nations with many states.
I agree that rightfully belong is a tricky term, especially when applied to territories, which have changed hands. Europe's full of those regions, however nationalism only really entered the equation from the 19th century onwards. It doesn't exclude, that someone's rightful gain (military victory) is seen as a not so rightful loss (military defeat) by the other.
In fact the word 'rightful' is a bit toxic in this context; both sides had a 'claim' (one maybe better than the other, but that's what we can debate about
).
Still even in this highly debated example, nationalism only played a secondary role, other considerations like military, internal politics, more classic motives for territorial gains (or reconquest, take your pick) used by every European state including Prussia and France etc.
Finally territories used to change hands without the populace being asked, what they wanted. That Dutch North Brabant ended up being separate from southern Brabant in Belgium, was not by the choice of the populace in the 16/17th century.