Nationalism as such is, contrary to some comments, not a natural trait in humans, although it may seem so.
Humans tend to simplify (since otherwise we could never grasp any thought, if we always tried to consider every micro-and macrocosmological aspect of it).
Also, we evolved in groups, as social animals.
Yet, people can typically remember something like 120 other people. If one tries to stay in contact with more than that, and tries to remember more than just some very basic facts, that requires quite some work.
The nation of course is a more or less synthetic construction, which was first created as kingdom or empire, and only later was "redefined" as a nation.
If you take a closer look at any state in existence, you soon notice that the different regions have more or less different language, are associated with different behaviour and whatnot.
Thus, the nation and subsequently nationalism are synthetic constructs, used to unite those different parts of the population of a country. Unfortunately, typically they are used to unite the people against some other group. The reasons are typically any kind of greed. Be it that the people employing the nation and invoking nationalist thoughts and feelings want to urge people into war (with an interesting aside: it's allways the people, but never the "brave leaders" that are supposed to have themselves shot), or to explain why it should be okay to treat those others in any bad way.
Say, we want to exploit those pesty foreigners (to get cheaper labour), then it helps a lot if those are deprived of the basic rights, and even more, to avoid them uprising, or simply refusing to be exploited.
If now one would provoque a situation where those one wants to exploit (the foreigners, in the first place) would be held down by the rest of the population (who in turn are given a cheap target for their own aggressions should they notice that somebody else is pinching the beef), then you could much more easily pursue your own greed, without too much fear of the torches and pitchforks.
So, after that long introduction, to answer your question:
Of course it would be a good idea to stop buying more and more weapons to (at least threaten to) shoot one another, and invest in education.
Of course that would make a much ebtter world.
Unfortunately, though, there is a small but extremely rich minority who don't have the slightest interest in that, because they can become richer in the current setup, and they might face quite some trouble if it changed.
And subsequently, they will use their money and resulting power to make sure that this won't happen.