No one was forcing him to write any letters of recommendation. What he had to comply with is not using his position as a state employee not to require students to take his religious oaths in doing his job.
I don't consider asking a student's position on human origins to be a religious oath. One can't simply protect any bizarre opinion from challenge by claiming it's religious.