A horse or an assembly line worker do lots of repetitive work. A programmer does lots of non-repetitive/creative work. It's a whole different game. There are examples of creative AI but it is clearly inferior to humans in music, painting, poetry, translation and many other tasks, while in programming it's completely incapable as of yet.
Maybe if conversational agents become good enough to replace lots of websites and apps - that could make a dent. Yet chatbots are quite limited today and in the next few years. It could take 5-10 years before they can be good enough to threaten app makers, and in the meantime there is a glut of unused apps.
The largest threat to programmers is Wordpress, Facebook and Ebay in my opinion. Instead of paying for a new website, Joe Business Owner would suffice with just a FB page or a Wordpress blog. Instead of making an online store, he would prefer being a simple Amazon or Ebay reseller.
Look what happened to horses. Steam engines and trains threatened to replace horses in the mid 1800s. A lot of things that were previously done by horses were replaced with trains and steam engines.
Yet the horse population grew, and cities remained full of horses. There were countless transportation innovations in the 1800s, from canals to streetcars and omnibuses to bicycles. But the horse population kept growing and showed no signs of being threatened by this "automation".
I wonder if horse economists thought that technology couldn't take horse jobs and could only increase them. Whenever something took a horses job, there will always be other jobs that technology can't do yet, right?
Then the car was invented, and within 2 decades the horse population crashed. Suddenly the price of feeding and maintaining a horse was much higher than the alternative. What happened? It's not like cars can do everything horses can do. They can't use grass as fuel, or be used on the vast majority of natural terrain, etc.
But cars were just good enough to fill the majority of the economic demand for horses. Trains, cable cars, bicycles, they just weren't good enough. But once technology hit a certain threshold "this time it's different" became true.
Robotics has made incredible advancements over the past 50 years or more. They have taken over entire factories, doing countless routine tasks previously done by humans. But they are still very limited. They have 0 intelligence - they can't see, they can't learn. They can only perform a rote series of movements. So there is still tons of work available for humans.
But with recent advancements in machine learning, this is about to change. A robot will soon be able to be trained to flip burgers, or drive a car, or take a customer's order, etc, etc. I can not imagine any jobs that an average, unskilled human can do, that a machine won't soon be able to do. Maybe skilled professions will be protected - I can't imagine robots being able to program computers for awhile. But the vast majority of humans can not be trained to be computer programmers. Just like most horses didn't become race horses - they became glue.