The other reason is that the US corporations have managed to capture a large pie of the value created by the internet.
A big factor is age discrimination. Companies prefer to hire younger developers. This drastically decreases supply.
Are salaries really that expensive once you factor in that the typical dev career is probably over by age 40? Accountants earn less but their career lasts a lifetime.
There are >40 devs, there's less of them because 20 years ago there were generally less devs, so you wouldn't expect to be the same amount of 50>40 devs as for example 35>25 devs. The sole fact that there's less of them (I think we can agree that there are >40 devs) doesn't have to mean that they just stopped working as devs - there are other reasons, right?
20 years ago, there were just as many young devs as there are today. I know because I was there. I also know that 20 years ago, there weren't very many (comparatively speaking) over the age of 40 --- just like today.
Age discrimination in tech fields is not even debateable.