A lot of the earlier magical girl series were light-hearted adventures, though back then, it was less about saving the world and more about the heroine working up the courage to confess to her love interest.
I'd say dark themes have been pretty common before the recent stuff, Sailor Moon being a prime example of that. It's been a while since I read the entire series, but I do remember storylines that dealt with insecurity, death, the fear of losing those most precious to you, and having some cosmic horror elements (which made sense since a lot of the villains were intergalactic).
I feel recently, and you see this with more superhero comics, there is a focus on what it does when you're the chosen one: when you're the hero who has to sacrifice your life and your mind for the sake of the world. When you watch magical girl series like Sailor Moon, CardCaptor Sakura, and Tokyo Mew Mew, they go through some heavy stuff to save the world: hiding their identities, trying to stop literal extinction, risking their lives with every villain they meet -- things like that. Though there isn't always a deeper dive into what that feels like. Not because it's not important -- rather, because the tone for those stories are still light-hearted. Yes, they go through these dangerous things, but they still have friendship and courage to help them pull through, and they don't have to sacrifice themselves to do that.
On the flip side, stories that dive deeper into the hero sacrifice show what it means to be a magical girl -- highlighting expectations that may be pushed onto the heroine and what that constant fighting does to her development as a person. And a lot of questions are tossed around: what happens if she doesn't win? What happens if she dies? What happens if her family and friends find out? Does she have to isolate herself to get the job done? Does she have to sacrifice her humanity to save humanity?
I guess the genre is so popular because it has both of these types of stories and dive into topics about femininity, identity, and heroism from different perspectives. It's also popular because these characters are often kids saving the world. Usagi from Sailor Moon was only 14 when she become a Sailor Scout, and most magical girls are either in high school or middle school. You got kids who are responsible with saving the world, all while trying to live a semi-normal life.
That speaks to kids who feel they're carrying the weight of the world on their shoulders and adults who felt like they had to grow up quick to take care of themselves (thus losing out on their childhood).