Most products go through a cycle where you need a lot of people to develop them at first, then they stabilize and require fewer people, and the other people move on to different products.
You can't just look at one product or team in isolation -- as long as there are new products to be built, there will be a need for those workers.
New products will be built always but with multilayered designs, more and more functionality is going in libraries/frameworks in lower layers. So a new product started today will not need as many developers. Again I am not arguing about the general quality of such product but new developments are using fewer developers than past.
A lot of the workers in India, for one example, worked on things you would hardly call programming. e.g. creating charts from data, manually moving data from db to db etc. These kinds of tasks should have (IMO) been automated in the first place, and should not require full time employees to handle them. As the automation become more mature, stable and well adopted, the bigger vendors start using them and don't require fleets of humans to manage them anymore. For a concrete example, I think ansible (and related tools) probably "destroyed" thousands of jobs as you didn't need to manage bash scripts manually etc.
There is another fleet of people who are hired simply for maintaining, developing on legacy systems, people you wouldn't find in the US. e.g. COBOL programmers.
[1]Well, we do, but nothing that's implemented on a large scale yet.
I can see in my own case 8 years back there were 12 people in team and now just 2. Slowly product got stable and people left for other opportunities and positions were filled for short time or never filled. But from business perspective this application is working just fine with few fixes here and there. There is no brand new next-gen replacement that would need scores of developers.