There are three reasons that nationalism still plays a progressive role in the world in oppressed nations:
1) super-exploitation
2) semi-feudalism
3) uniting migrants with the super-exploited
When a country is super-exploited by another through a puppet comprador-lackey regime, the workers toil more exploited than ever before, because fascist regimes coerce the workers to work for the imperialist country masters for a pittance compared with the legal wages in the imperialist countries.
That is in Lenin already.
It is also in Lenin, Stalin (and even Trotsky counter to today's popular myths) and others in the 1920s that nationalism may play a positive role in uniting capitalist classes and workers against semi-feudalism. Often it is the imperialists propping up semi-feudalism and it is the nationalist masses who want to build their countries at least in a capitalist way.
See a quote from Lenin, Stalin and Trotsky on Turkey along these lines.
Finally, nationalism plays a progressive role when it causes people located inside the imperialist countries to unite with the people of their native lands that are still super-exploited.
These three reasons are also the economic content of principal contradiction in the world today --the struggle of the oppressed nations against imperialism.
When nationalism has no role to play in uniting people against backward forms of exploitation, nationalism is reactionary. That includes all imperialist country cases of nationalism. The imperialists already have the most advanced economic system and their nationalism does not drive their system forward to socialism. Quite the opposite, imperialist country nationalism supports the backwardness of the Third World and brings about endless war.
Nationalism is also reactionary when the target is other oppressed nations. The only revolutionary nationalism targets imperialism as the enemy and no oppressed nations. Stalin said: "This does not mean, of course, that the proletariat must support every national movement, everywhere and always, in every individual concrete case. It means that support must be given to such national movements as tend to weaken, to overthrow imperialism, and not to strengthen and preserve it. Cases occur when the national movements in certain oppressed countries come into conflict with the interests of the development of the proletarian movement. In such cases support is, of course, entirely out of the question."
"Foundations of Leninism," by Joseph Stalin, Works, Vol. 6, (Foreign Language Publishing House, Moscow, 1953), pp. 145-7.