Nationalism is a band-aid for the wound inflicted on society by the artificial suppression of the more natural tribalism.
It all boils down to the formation of an in-group and an out-group. Which happens invariably. The natural tendency to tribalism will usually express itself somehow - the alternative is a total free-for-all. So people become very attached to sports teams, organisations, political blocs, and so on. You see it in racial interest groups - however it's framed, a lot of these BLM, Hispanic issues, women's rights, etc, it's an expression of this same tendency; hustling for the advancement of the in-group.
Nationalism is about an artificial tribe-like construct, and it's one that offers membership to people regardless of race or gender as long as they adhere to the ideals of the pseudotribe, and have a greater allegiance to it than whatever tribe they were born into. That is to say; unless it's ethnic nationalism. Which is often an abstract pseudotribe regardless, formed of several ethnicities that have lived within the same borders on the map for some generations and look sufficiently similar to each other.
No matter how progressive you think yourself, this is the hardware we all run on. Nationalism is a workaround. Every form of globalism or internationalism always breaks down into various "uses" and "thems", every time.