I'm going to go out on a limb here and guess you have no actual experience with teachers unions, teachers contracts, teachers liability, or school districts in general other than your own time attending schools.

I have no love for unions in general, especially those I've had the misfortune of dealing with in the tech sector. I do however appreciate some of what the teachers union my wife is a member of provides. All teachers in our state (and most others) are required to purchase and hold liability insurance at all times. The union has negotiated rates that are over 50% less than individual rates offered by these same insurers. The union has legal representatives available to protect teachers from many different types of actions, this includes the very real threat of false accusations made by students or their parents. The school districts don't provide any of those services, and in some cases are legally prohibited from doing so as teachers are state/county employees so they fall under various laws that limit the benefits that can be offered to state workers. Teachers unions also provide representatives to mediate disputes between fellow teachers, administrators, parents, and district staff. This service can be invaluable, especially when mediating disputes between staff members and principles. Having a run in with a principle can ruin a teachers career due to the nature of how many administrations work and the good old boy system at work during hiring at many schools.

While teachers unions do use collective bargaining to negotiate contracts which include salary schedules this only has a minimum effect on most teachers. Some stellar teachers don't make as much as they might, and some mediocre teachers make more than they should. The problem is that even without the teachers union state laws often limit compensation that can be offered anyway, and at least in my state, compensation packages are done in groups or packages regardless of whether or not those workers are unionized. This means that superstar teachers wouldn't be able to get higher salaries than they do now anyway. Given that almost all state workers here are payed based on time on the job and job classification there would be very little difference. It could actually be worse given that teachers currently get more money based on their continued education in addition to years of service. This provides incentive to teachers to continue to learn and, in theory, become better teachers.

As for mediocre teachers being defended by the union, that's an unfortunate consequence of what the union offers. There are several well publicized cases of horrible or mediocre teachers being protected zealously by out of control unions or union reps. Given the total number of teachers employed, the total number of cases the unions mediate, these are the exception and not the rule. You aren't going to read about a teacher being protected by a false student accusation unless it actually goes to court. As a member of the union if there is any type of a dispute you have the right to call on the union to defend you. In most cases this is still a problem with the mediocre teacher and not the union directly. By paying those union dues the teacher gets the right to have the union step in on their behalf. In some cases you'll notice that there's a problem with public service in general. The teachers union has negotiated for contracts and rules that are unbelievable, so have the police, tech and other unions. For whatever reason people love to single out teachers unions and teachers in general.

My experience since my wife has become a teacher and I've become much more aware of what goes on at schools is that most people arguing for changes in schools have no idea what they are talking about. They have not volunteered at schools, they have not actively participated in school board meetings, they have never seen a teachers contract, they don't understand the laws that are already in place, they don't read the legislation that's pending on the state or federal level, and they don't think about or understand the consequences of the legislation they do read. There's a lot of that in the discussions about education on HN too as well.