Many of them do. Canada and India both have some excellent educational instutions. Yet there's often far more lucrative opportunities for an ambitious 20-something in the US than they can easily find in the location they may happen to already be in.
Leveling up is a long, slow process of decades. Immigration offers to improve someone's life a lot faster.
Canada’s dealt with a brain drain problem to the US for a couple of decades at least. The amount of folks I know who got educated in Canada and eventually moved to the US due to CoL and salaries is significant.
In the United States there have been scholarship programs sponsored by the US government that pay for a students IT degree in exchange for government employment for X years after graduation. Obviously, government pays less than private sector, but at least you have a job and a degree. It would be lovely if private companies offered similar programs. The cynical answer as to why they don't is because it's cheaper to import workers than train them here, plus importing more workers suppresses wages (see supply and demand) and brain drains foreign competition.
Leveling up is a long, slow process of decades. Immigration offers to improve someone's life a lot faster.