It isn't like any other industry hires only "good" people, though, so calling out teaching for that - especially if your area has a shortage - seems a bit unfair.
I suspect that perhaps you are not a teacher, and have never applied for teaching work. Or maybe you live somewhere where school hiring practices are very irresponsible.
My daughter is a teacher who has just changed jobs. The process was something like this:
* Apply (CV, plus extensive covering letter)
* Prospective new head knows old head (they all know one another) so they talk
* Candidate gets an interview, and has to prepare a class
* Interview day: candidate delivers prepared class, observed by head and head-of-year
* Candidate is interviewed at length by a panel of three teachers, including head
* Decision made subject to references
* References taken up; award position
What you've described is a process that isn't even appropriate for a supermarket checkout clerk.
Here in the UK, people have employment rights, including the right not to be dismissed without process. That involves warning the employee twice verbally, putting in place measures to help them improve their performance, and then a final written warning. Teachers here are unionised; they can take their employer to an employment tribunal, which is a kind of court, for the offence of Unfair Dismissal. It takes time and money to fire someone for underperformance.
Consequently recruitment is done rather carefully - more carefully than in many software companies, judging by the calibre of some of the colleagues I've worked with.
FTR I used to be a school governor in a state-run primary school.