There isn't a shortage of software developers. The pay isn't great--the kids getting $300K packages out of Stanford are an exception; it's a marketing expense. In fact, if you control for the level of intelligence it takes to be any good, SWEs make less (and get far less autonomy--do you think lawyers work on Jira tickets?) than any other professional, and they hit a salary/challenge plateau quick... after which, they increasingly face ageism.
People leave because the job sucks. I don't mean that programming sucks; I quite enjoy it. Computer science is still an engaging field worth studying, and research programming isn't bad at all. Corporate SWE is pretty awful, though; you get paid far too little and treated far too shabbily to justify spending hours dealing with bugs and bad decisions that exist not because you're working on hard problems (after all, I've generated my share of bugs and bad decisions) but because of inadequate processes, mindless cost-cutting, generic incompetence, and an overall lack of care, especially at the top. All of this, to make a barely middle-class salary while people who are already rich and connected make millions off my work? No thanks. 2.25/5, would not do again.
People leave because the job sucks. I don't mean that programming sucks; I quite enjoy it. Computer science is still an engaging field worth studying, and research programming isn't bad at all. Corporate SWE is pretty awful, though; you get paid far too little and treated far too shabbily to justify spending hours dealing with bugs and bad decisions that exist not because you're working on hard problems (after all, I've generated my share of bugs and bad decisions) but because of inadequate processes, mindless cost-cutting, generic incompetence, and an overall lack of care, especially at the top. All of this, to make a barely middle-class salary while people who are already rich and connected make millions off my work? No thanks. 2.25/5, would not do again.