It's actually state law that a "qualified" teacher get a job over a non-teacher. I don't remember the exact cite, but it's the law. They did pass a new law, though, that a district does not have to replace a returning non-teacher if a qualified teacher says she wants the position.
I would certainly imagine the union was behind the original law, which I think is a bad law. Why not simply hire the best person for a coaching job? If an AD wants to give points to a candidate because he is a teacher or in the building, fine, but tying the AD's hands with a law might be in the best interest of the teacher's union, but not the student/athletes.