I think this is only true if you have a family
and want to live
in the tech hub city (instead of a suburb). I'm a Vancouver-based developer who has consistently made about 25-40%
less than the national median salary for people with my experience. I agree, the salaries aren't what they are in the U.S., and you certainly won't be buying a house in Vancouver any time soon, but I've made ends meet just fine. In Vancouver, at least, there's a trade-off with work-life balance. You make less than you would in the U.S., but work-life balance tends to skew more towards the "life" end (people taking off early for hikes or beach days is quite common at most companies).
Yes, I could make more if I worked a lot more, or worked in the U.S., but it's not worth it to me (as someone who doesn't want kids). When I'm employed, I still live a much more comfortable life than the majority of people in Vancouver, let alone globally.