There definitely is a trend away from gritty campaign settings which feature "bad things" like inequality, racism, crude and unfair laws, feudalism, slavery and serfdom, etc.
However, those bad things can be important tools to transport the story into "another time". I can only speak for myself, but pseudo-medieval fantasy doesn't quite feel right when coupled with modern sensibilities.
The things remain bad to the characters that are exposed to it. The usefulness is as narrative tools, to set a tone, to signal we're not in Kansas anymore: don't expect people to act or even think in modern ways.
(I definitely don't mind people enjoying an alternate reality like Bridgerton where black people are well integrated into the nobility of England, but not ALL depictions of faux-historical societies should have historical wrongs removed)
This goes back to my old comparison of Luke Cage vs Black Panther. Luke Cage lives in a reasonably realistic (for comics, that is) version of Harlem: rampant crime, racist cops, poverty. The difference from the real world is that Luke Cage has the means to do something about that. I believe the TV series at one point referred to him as "a racist cop's worst nightmare: a bulletproof (bleep)." And there's definitely a kind of catharsis in playing in a world where things suck, but you can set things right.
But at the other end, we have Black Panther, who lives in Wakanda. Wakanda is a futuristic utopia, that was never colonized because they had the means to resist, and never had to bow down to European or other outside influence. Life is great if you're Wakandan, and the Black Panther is mostly about maintaining that power and possibly redirecting it in other directions than isolationism. And there's a different kind of joy in playing in a world where things don't suck, and your job is to keep things from sucking.
I'm a white cis dude who lives in one of the world's most affluent and happy countries. It's not a perfect life, but I'm pretty much playing life on easy mode. So having some hardships in the games I play is... exciting, might be the right word. In a Luke Cage campaign, I might experience vicarious hardship, but I will probably be able to fight back, or at least climb on top of the heap. But for someone in less fortunate circumstances, having the same or worse hardships in-game might not be their idea of a good time. And for a company like Wizards of the Coast who's always aiming at a broad audience, it probably makes more sense to be welcoming than to turn people off. And it's not like I have a problem with Black Panther-style worlds either where the threat is external.
I think this one is a matter of deconstructing “madness” and reconstructing something else to fill its thematic space. Part of how Lovecraft played on the fear of mental illness in his work was to imply that what we consider sanity is really just blissful ignorance, and what we mistake for madness is just deeper insight into truths too horrible to accept. I would recommend those who want to play with themes of cosmic horror lean into that. Glimpsing the horror of the far realm doesn’t “drive you insane,” it’s just deeply traumatic. For a good example of this done well, I look to Bloodborne, where instead of a depleting sanity score, you have an increasing Insight score. With higher Insight, you start to see things that were there all along, but your mind couldn’t accept; and once you see them, and they see you seeing them, they pose a greater threat to you.
Fate of Cthulhu does some interesting stuff in this realm. There, exposure to the Mythos doesn't necessarily make you "mad", but it does make you strange, perhaps physically and perhaps mentally.
I think Amonkhet is worse than Dark Sun, because it is artificially manipulated. As I recall, the Egyptian-style civilization there had a huge focus on being competitive, with the best of the best earning the right to "eternal life" as mummies. Only it turned out that it was all a lie perpetuated by one of Magic's big bads, Nicol Bolas, in order to get an army of exceptionally powerful zombies to use to invade other planes.The only magic setting that gets vaguely close is Amonkhet, and it's still quite a bit different from Dark Sun and not nearly as crapsack of a world. I don't think there's value in abandoning the IP, just that it's a VERY difficult setting to do right. 4e's version of it sold well, but it still wasn't nearly thoughtful enough about the potential for propping up really problematic things.