>>1961331I'm not a PhD but am a skilled immigrant and know numerous people who did this. How easy it is to stay depends on your target country (e.g. you're basically guaranteed to be able to stay in Germany or Canada, while in the UK or Switzerland the bar is higher). Oftentimes student visas come with a year or two of sponsorship-free employment, but finding an industry sponsor in general is extremely difficult unless you're targeting a career in tech, pharma, engineering/manufacturing, or finance (particularly quant at HFT firms). Most employers are reluctant to gamble on new grads even without sponsorship as a consideration, so if you planned on going the industry route, you'd have to focus on making yourself as attractive a candidate as possible while studying (e.g. internships, research on an emerging hot topic in your field of choice).
Most worthwhile countries do have a path to permanent residency particularly for academics that's actually much easier than it is for industry workers, but I'm not sure how/if postdoc roles factor into that, and academia is a pyramid scheme, so banking on tenure track is a bad idea unless you're entering one of the global top programs in your field.
If you're planning on studying in a field where there isn't industry demand for PhDs and you aren't a nepobaby, your most realistic options for staying are marriage, becoming a teacher (there's enormous demand in english-speaking countries right now and a PhD would look attractive to international schools), targeting a country with a PR track that doesn't require sponsorship, or finding a stupid cheat code visa like DAFT.
Sorry if you're already studying and this is all totally irrelevant to you.