Part of the reason this is so prickly is that a huge part of what actually happens in the classroom is ancillary to instruction. And always has been. And is for the good of children.
We expect teachers to be robots when we want to chastise them, but we expect teachers to be surrogate parents when they're helping turn students into productive members of society.
> The government has every right to decide the content of the material being provided to kids in public schools.
An interesting nuance to this particular case is that it is the state government that is imposing the requirement while it is a local (city, town or county) government which hires the teachers.
In most US states, local governments are explicitly given power by the state government. It is not like the relationship between state and federal governments: the local governments are strictly beneath the state government.
To use a different example: a public bus driver shouldn’t be fired for an offhand comment. But they have to drive the routes the government tells them to drive. That’s not a “freedom of movement” issue.