Rulership is about politics, politics is about power, and the greatest power, in a fantasy setting, is god(s).
It seems to me that the only way a setting would have religion NOT be in the supreme rulership position is when the evil deities are of sufficiently lesser power than the good deities that the good guys can take a hands off approach
I came to this conclusion myself, but didn't like the constraints this would put on the kinds of settings and adventures that would be possible.
So I decided to make gods all but nonsentient - effectively insane or maybe just eternally sleeping (I'm sure I've picked this up from something I once read).
The end result of this is that priesthoods are only as powerful as their priests and followers.
Once you're there it's a simple matter to limit the powers of individual religions by making them compete with each other.
So if they're competing for both the goodwill of the ruling class and the hearts and minds of the common folk, they're all of a sudden no more powerful than any other organisation.
And we're alowed to continue with such fantasy tropes as secular martial aristocracies, magocracies, and any other power base that is not a theocracy.
Because a fantasy world full of theocracies might be fun for one campaign but the lack of diversity would wear pretty thin before long.