I'll try give it you from another pespective - being a member of staff in a school. That being said, I don't actually agree with some of the 'rules' for students/staff at our school either.
Homework class, don't see the issue - they need to get their homework done or stay in school to get it done. I don't totally agree with homework, but that's not an entirely unfair rule.
Teachers, at least male teachers, still wear their ties to the very end. However, obviously blazers come off if they choose to. I am sure that if it is actually too hot, students would be allowed to take off their blazers. Female teachers, at least get a choice of dress/trousers etc. dependent on weather.
Toilets are locked for various reasons - the epidemic of kids (even in primary) vaping in the toilets, vandalism, bullying etc. It is extremely hard to manage. Teachers are leaving in droves, because unless you actually experience the 'career' you can't really say they have it easy. Not saying that you have said this, but general public view seems to be this.
Detentions for lateness, absolutely. Most schools give a 'grace' time, if you rock up over 5 minutes late - for example - yeah, make it up. Get there quicker and/or have a good reason for being late. Forgetting equipment, massive problem - those who can't afford equipment, can always get some handed for free.
You'd be surprised how teachers are treated as a member of staff. Then, think about how they are treated from parents. Not all parents, thankfully. They are there to teach, not to be a parent.
However, the expectation for teachers (in primary and secondary) to know each childs medical history, SEND information, certain home-life information, to plan all those lessons taking everything into account, with the influx of EAL (English as an additional language) students and planning for those - with approximately 10-20% of their timetable to do all this.