In Sweden, for example someone from Iceland (2 years) and Ireland (5 years) can get citizenship "by just working there for a few years". Immediately I don't think happens many places, but less than a decade does.
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.