I can say about Germany. There is a working visa for qualified workers called Blue Card which is what most software engineers get. With it you can stay unemployed for three months and can apply for a jobseeker visa after that without having to return. Also if you know German above certain level you can get a permanent residency after less than two years, which is not tied to being employed