I think you are approaching your question “why do people who can’t write a simple program even entertain the idea they can get jobs as working programmers?” the wrong way. As a fellow passionate developer it is easy to look at what these people do as not in line with our ideals, that they are frauds and should be ashamed of themselves.
The truth is much simpler. Most universities are structured in a way such that you can attain a degree without knowing the subject all that well (whether that be by cheating or just barely passing). This is true not of just CS, but many degrees. So you end up with a student who owes a lot of money with a piece of paper that says he knows how to program, what do you expect him to do?