Brad gives some good advice.
I would add that every place is different. Picking Canada at random, devs are in high demand, as shown here.
It is a lot of work to get a work visa in another country. It takes a lot of work by the company and it may not be worth it to them. It takes money, paperwork, and often they have to prove that they don’t have enough natives to do it. If the occupation is on a list like this, that means that they are having trouble finding people. Additionally, the gov will sometimes fast-track people in in-demand lines of work (the laws vary by country). But often they will want some kind of proof of qualification - degrees, certificates, a verifiable work history.
So yeah, this can work. The whole plan would probably take at least 5 years (finishing your learning and getting a couple years of experience), but even that might be a little optimistic.
But you shouldn’t study web dev because you want to move to Canada. You should study it because you enjoy it. Then, if you work hard enough, you might be able to accomplish some of your goals.
I’m in a similar boat - I’m in the US but we want to move to Spain. But I have a job that I can work remotely so it’s not as much of an issue.