I'm a software dev as well, coming from a family of educators (dad, mom, brother, all three have taught at some point during their career or for an extended part of their career).
The problem I think is that you're examining 'working more' in the context of 'work output'. As a developer, it is very much about 'work output', however as a teacher it is often not.
In my moms example, she had roughly 6x50 minute classes a day, with a 10 minute break between each one. So, roughly 6 hours of 'meetings', since those 10 minutes in between were really just prepping for the next class, and oftentimes speaking to students in between too. That in and of itself is draining. This is the schedule of a manager, more or less - 6 hours of meetings where you need to be "on" and can't zone out.
The problem is that teachers don't just operate on a manager schedule. They also operate on a maker schedule: designing lesson plans. My mom's other 2x50 minute blocks were designated for a 50 minute lunch break and 50 minutes of planning. But 50 minutes of planning is not nearly enough time to plan two classes that my mom teaches every day. So, no actual lunch break, the lunch break is actually eating while planning. And that's still not really enough time, so my mom would get there an hour early and stay an hour late. She worked 7am-530pm M-F, and since getting behind on lesson plans means you need to put on a movie which puts your kids behind, she often worked 3-4 hours on Sunday to prepare for the week ahead. This is not my mom being an overachiever, or being dedicated to her work, this is her being dedicated to ensuring that she is just doing her job. This is what the job requires. Sure, it does get easier over time as you get to reuse lesson plans.
The point I want to drive home is not that working 7am-530pm is "more [time] than most professionals", but rather the quality of work is so much different, and so much harder. Managing a classroom of 25-30 children, middle schoolers in her case, is draining, so much more draining than coding. It is more draining than being a manager, because your team is often 3x as big and significantly less behaved (they're children after all).
The cherry on top is that my first job out of college as a developer I was already making $30k more than my mom a year. She had a masters and 10yrs of experience at the time. I am not under the illusion that I am smarter or more qualified.
To answer your statement of "I also need to do trainings, mentorings, networking", teachers regularly need to do trainings too. For my mom, these trainings are required - she was required to do something like 20 hours of professional development a year. And they often mentor students as well, as you absolutely experienced during your own education whenever you went to a teacher during their lunch break for help. I don't think tutoring versus mentoring is that hard. Having someone come to you with questions is an easy way of educating someone. The hard part is lesson plans, to think through a year of "how can I distill this knowledge down and transfer it?", which I personally have never needed to do as a tutor.
To answer your question of "why don't they change professions?", I think that's rather naive. Not everyone is on the path of trying to optimize financial independence and minimize time spent working. Why do folks go into journalism? Or art, or music? Are those people stupid, because they aren't in software engineering where work is more lucrative and easier?
> teachers work more in 9 months than most professionals work in a year
I do think this is an overstatement, maybe a little. Maybe not. It depends on the teacher and the subject. I hope these explanations help, growing up I definitely did not realize how hard my "good" teachers worked to provide me a solid education.