Nationalism is, again, about a particular approach to history and the legitimization of a particular form of state that's perceived as natural based on that history. Nationalism is not the idea that a state should be coherent per se. You cannot have nationalism without a reference to history, demonstrating the nation as a natural continuum in some way. In regards to the definition provided by Flying Pig/Wikipedia, I particularly like the parts "sovereignty/autonomy over a territory of historical significance to the group" and that it is "oriented towards the development and maintenance of a common communal identity", which appeals, again, to a larger historical construct. I have never seen an example of nationalism that hasn't appealed to the past somehow, as a legitimization of a group as a continuum, and I cannot fathom a form of nationalism that expects this group to fundamentally change in the future. Also, factual coherence is also sometimes thrown into the gutter in favor of idealistic coherence. I can look at Greek nationalism that sees Greece as a continuum from ancient and classical Greece, the Eastern Roman Empire, the Greek territory under the Ottomans and the resurgence of Greece in the late modern era. This is an ordinary attitude among Greek nationalists, and the imaginary is maintained even through the vastly different political ideologies and identites and traditions of the Greek-speaking nations of history. (EDIT: See? Now even I did the error of equating nation and state, as a colloquial synonym) Danish history could be seen as more coherent as the ethnic coherence and historical territory has changed very little, however, the ideologies of Denmark hasn't been stable at all, rather, it is a mishmash of vastly different ideological and cultural traditions that were unified as a construct among conservatives in the 19th century.
Now, this construct has often proven very powerful in maintaining coherence in the state. But there are other sources of coherence. You could point to the concurrent developments of pan-Scandinavian identites that I'm part of. This isn't an appeal to a common ancestry as much as it's actually an appeal to a common tradition of humanist, progressive and ecological ideas. The appeal of these movements is completely different than an appeal to primordialism. Also you can point to points in history where stable, coherent states existed in spite of no true ethnic or historical tradition. You can point to points in history where subsets of ethnic groups appealed to their own sovereignty over a pan-sovereignty of the broader nation. Or you can point to points in history where some nation state has been constructed but in fact has definite subsets of ethnicities that cancel out the true historical or ethnic coherence.