Leftists sometimes consider nationalism 'good' when it is nationalism of a small nation against an imperium (or minority ethnicity against a nation state), but 'bad' when it is a powerful nation trying to conquer its neighbors (or opressing its ethnic minorities). But in facts, both of these nationalisms are based on the same toxic concept of ingroupness based on shared ethnicity, language and culture, in contrast of ingroupness based on shared commitment to universalist ideas like freedom, rule of law and democracy.
OTOH, it is likely that the real reason why countries really work is because of some level of nationalism, as commitment to universalist ideas is primarily a thing for elites, while ethnicity-based tribalism is much more primal concept.