This isn't just not thinking before you speak and saying something stupid. Something like this takes some degree of planning, preparation, approval, promotion, etc.. So certainly, he had plenty of time to consider/reconsider this, but evidently decided there was absolutely nothing wrong with it. It didn't set off any red flags in him because he really isn't a religious person at all, and so likely can't comprehend why anyone would object.
That might not be so bad if he didn't try to pretend that he was devout when it is convenient to his personal and political goals.