In Sweden, if you're from outside the EU, you can get citizenship after 5 years working in the country. I believe that for EU citizens it's less than that.
In many other countries, like Australia and (I think?) Canada, for example, one can become a citizen after 4 years living and working in the country.
Legally. I don't believe the path to citizenship is paved if you are working and staying in either of those countries illegally.
Both Australia and Canada are quite picky on whom they let in. It's points based, supposed to be fit to the needs of the country.
For giggles, I took my score for Canada. As a middle-aged individual, I wouldn't be able to get in under the normal program even while nearly topping out most other categories (I speak English and French, have advanced degrees, etc).
Of course, you can buy your way in to almost any country.
I was talking about legal immigrants. If you're caught illegally in Australia you're basically immediately deported even if you've managed to stay in the country illegally for many years. There were some notorious cases of people being deported after 20 years in the country (not sure if the outcry from their supporters actually stopped any deportation)... Sweden is almost as dacronian. It is known to deport parents of children born in Sweden (who are legally Swedish citizens) because they were illegally in the country.