The fact that ya and waw belong to the assimilation group does not mean nun assimilates before them everywhere. When an unvowelled nun and ya or waw occur in one word, certain recognized Qur'anic words preserve nun by izhar mutlaq, or absolute clarity. This preserves the received phonetic structure of these words.
«دُنْيَا» — nun before ya within one word: clear.
«بُنْيَانٌ» — nun remains clear before ya.
«قِنْوَانٌ» — clear nun before waw.
«صِنْوَانٌ» — clear nun before waw.
Contrast: «مَنْ يَعْمَلْ» has two words and takes nasal assimilation; «دُنْيَا» is a single word and keeps clear nun. Word boundaries are therefore essential to a correct ruling.