Countries usually decide whether to grant visa-free travel based on the likelihood that travellers from that country will become illegal immigrants. For Nepal, this is considered very likely. For North Korea, it's exceedingly unlikely, because it's so difficult to leave the country in the first place, those who are allowed to leave are carefully vetted, and their family back home is essentially held hostage to ensure they return.
Sure, but illegal immigration is hardly the only reason for visas (many countries have concerns over organised crime for example), and it ranks well below other countries that have similar reputations for illegal immigration. For example Congo and South Sudan rank higher and given the refugee numbers from those countries I'd imagine they are a large source of illegal immigration too.