He had two obligations, his moral obligations to his students and his obligation as a school system employee, which were in conflict. He choose his moral obligation to his students, but in doing so violated his obligation as a school system employee. The school system did not ask him to perform anything illegal or definitively immoral. It is therefore correct for the school system to punish him for this violation.
If the school system asked him to do something, anything that is in conflict with his moral obligations to students - as you claim - then it DID ask him to perform something immoral.
I should have been clearer. From his point of view he had a moral obligation to his students. I actually don't think he did.
The school system should be following a combination of legal code and the generally accepted morals of the community they represent. Notification was provided to parents. Parents could opt out and there was no general movement by parents to prevent the survey. The school therefore didn't ask him to do anything which is "definitively immoral".
People including myself have to make judgements like this at different times during their career. I have worked for companies which have asked me to perform actions which I personally have found against my moral code but which aren't illegal and may not be considered immoral by society as a whole. Sometimes I have done them and other times I have not. It has depended on how large of a violation of my own moral code I though it was. Anytime I have refused I have fully expected and received negative reactions from my employer. To actively interfere with the goals or requests of your employer and not expect a negative reaction is just idiotic.
According to the article there was a specific script to be followed when distributing the survey. By informing the students of their 5th amendment rights he deviated from this script. Beyond this it was obviously the intent of the school system for students to complete the survey fully and honestly. He knowingly took actions which he knew might lead students to not doing so.
The article didn't say that he did not read the script - just that he also offered information about the 5th amendment. That's not an instance of failing to fulfill his obligations. Also, even if he acted in a way to thwart the "intent" of the school system administration, which has not been demonstrated, it is not at all clear that this constitutes a failure to fulfill his obligations as an employee. It might be that his obligations should be interpreted as including the thwarting of the intent of the administration in some instances. Just as a soldier in the American army is obligated to disobey an illegal order.