I can't speak to all of the shows mentioned here, but my first time watching it,
The Sopranos surprised me with its approach to religion. While we can all now say Carmella was an immense hypocrite, I felt that watching her pray for Chris when he was in the hospital in Season 2 was a jarringly different portrayal of religion than we would expect today. What I mean is that, even though we know Carmella isn't exactly living up to her moral responsibilities in several dimensions, her prayer, and her desire to see Chrissy survive, is sincere and heartfelt. In a contemporary TV show (say coming out sometime in the 2010s to present), I think this would have only been another chance to show that religious characters are hypocrites, morons, or monsters.
As for
The Wire, which I just wrapped up rewatching, I feel that the relatively positive portrayal of religious figures is entirely due to the show's setting in a poverty-stricken city. That said, David Simon certainly could have portrayed preachers as grifters, something which he seems to actively avoid doing.
The Simpsons is and was the show that has the exploration of religion and belief at it's core. They go to church. Lisa embraced Buddism and Bart earned his soul. But again, thirty years ago they were attacked by some for being 'unChristian
I thought of The Simpsons last night when thinking about this thread, yes! Even the episode with Bart converting to Catholicism, which came at a fairly gimmicky time in the show's history, is a lot better than a similar plot would probably be in most other shows. And of course "Homer the Heretic" is an all-time classic, as is "In Marge We Trust".
My parents had never let I or my brother watch
The Simpsons when we were kids (think 2000s). When I finally took it on myself to explore the canon last summer, I was struck by the show's religious content. Watching Bart feel like he wouldn't enter Heaven because he sold his soul had me internally screaming "
What did they think they were 'protecting' us from!?"