Universities aren't trying to hire someone who can teach undergraduate CS courses. They're trying to hire someone who can build a lab capable of bringing in a steady stream of seven-figure grants. You need to have a PhD from a top-five (ish) school, with an excellent publication record, and an existing network of collaborators to be competitive for the vast majority of open positions.