With programming they built this whole myth that "coding is easy, bro, trust me, you don't even need to know maths" and then people approach it with an according attitude. Once they actually progress from doing CodeAcademy courses to more real-world-like programming they hit a wall, programming turning out to be hard doesn't fit their mental model of it being easy, they decide it's not for them and leave it.
On the other hand, it could be argued that people who need to be convinced to overcome difficulties in progressing in a skill are not suited for it, but I'd still say that the world could do with more honesty so people can calibrate their expectations appropriately.