You can't ban voluntary speech, especially if your aim is to "sanitize" all speech on government property of any reference to theism (because that would create a bias towards atheism).
If the court had said that people can't be compelled to pledge, then that would have been one thing (although possibly outside the scope of that case even then).
But they went further than that. They said that people can't make the pledge at all in front of students.
They can't do that, Constitutionally, and that's why their decision will be voided, either by themselves or by the Supreme Court.
Voluntary speech can't be banned, after all.
I hadn't noticed such, but it would be great news if they had.