I think fictitious worlds with real world religions can work, not sure what my exemplars of good fantasy religion would be though - I guess Small Gods for me feels like one of the best fantasy + religion takes, and Feet of Clay, but those are both more satires around those issues anyway.
I do think it's super difficult to make fictitious religion work well, and agree it's usually done to tick a box - GRRM's religions feel like that for example. The difficulty IMO is admitting all the different facets of religion and how it's interwoven with societies and mentalities. Often authors think very structurally about a religion, so they design it as a societal institution, possibly with a core theology that they all follow, and that's that. But the practical real impacts of religion are much more subtle and less hierarchically driven than that sort of top-down model implies, because most religious people experience religion via worship practices. In fiction these are at most often boiled down to "priest gives sermon which alpha male hero character can be cynical about", but to make it work I think you'd have to think much more about how different people in society tie in with religious ceremonies and practices, how these reflect their respective roles and positions, and also about heterodoxy and the fact that almost no real people literally believe, or even know, the full complex theology of their own religions.
This might be a good topic for an Exilian article sometime...