Nation state: a sovereign state of which most of the citizens or subjects are united also by factors which define a nation, such as language or common descent. Multinational state: a sovereign state where more than one ethnic group forms an important part of the population.
Not all states are nation states dominated by one group: many are multinational states where different ethnic and cultural groups live together with equal rights to representation in government and the law. Switzerland, for example, is a country made up of four different linguistic groups (French speakers, German speakers, Romansh speakers and Italian speakers), all of which have differing cultural traditions and heritage, but the groups coexist in one country where they are subject to the same laws.  However, these groups still largely live in their own areas of Switzerland: Geneva is a prominently French-speaking area, whilst those in Zurich speak German, suggesting that nationalism on a smaller level is more important than the overall makeup of the state. This indicates that the existence of Swiss nationalism is not relevant to the overall ethnic and cultural makeup of the country, so nationalism is not necessarily a reason for the formation of political states, meaning it preceded the formation of modern nation states.
However, a large number of states do have a dominant ethnic group, creating the conditions for strong nationalist feelings which would not necessarily otherwise exist. Additionally, different groups being subject to the same laws in a country does not mean they are in practice treated equally, or that nationalism does not still exist on a significant level.
This argument is a relatively recent one because modern multinational states have only existed since fairly recently in history, but it draws on the historic precedent of multiple ethnic or cultural groups living in the same geographical region, but their own specific areas.
Not all states are dominated by one ethnic group, so states cannot create nationalist feeling. Nationalism often exists on a smaller level than the makeup of a nation state. Nationalism is not always a reason for the formation of a state.