And the Fourteenth extended that to the states.
So when a rogue judge tries to advance his religion using his state office, he gets slapped down.
As he should have been.
"Advancing a religion" and "making a law" are not synonymous. The First Amendment doesn't prohibit "advancing a religion", as long as no law was made in doing so.