I agree with your point but I think it should be clarified. There is probably not a theoretical shortage of people who can be called "software developers" compared to the number of jobs available. But I find that shortages are relative. Companies make their own bars for who they're willing to hire, and how far above or below a given baseline level of competency they'd like to target.
Not all software developers with that title can be software developers at any given company. This is not just because they don't know the underlying theory or because they don't know "real" engineering. So it's much harder to discern if there's actually a shortage, because obviously not all jobs with the same title involve the same specialization or skill requirements.
I think that a more charitable interpretation is Google and other such companies use these interviewing practices because their ideation of a "software developer" is substantially different from the all-inclusive title. It's not just an arbitrary way to reduce the stack of resumes, it's an imperfect proxy for their actual criteria.
I believe things were quite similar in India during the dotcom bubble. Candidates were asked to do some addition programs, hir d immidietely, and within weeks their H1B was sponsored.
Because contrary to the narrative, there is no shortage of developers, there is in fact a glut so companies can not only afford to be choosy, they actually need to filter early to keep volume of applicants manageable. At least that is my interpretation of the evidence, I am curious if there is another explanation.
I can remember when there really was a shortage of developers, the dotcom boom. Companies couldn’t shove people in the door fast enough, an interview was a quick chat followed by “when can you start?”. Today it’s nothing like that. In a genuine shortage there is no ageism etc either, noone can afford it.