I think there are a number of reasons why it's fallen out of favor. One is that series fiction is more serialized now, so you can't just use the same plot formula over and over; you need an ongoing narrative with changes in the status quo. So secrets tend to come out over the course of the story, and it's better for characters to be in the loop so that their relationships can advance, while characters kept out of the loop of a big secret tend to have a more static role (like how Aunt May got to grow far more as a character after she found out Peter Parker was Spider-Man). Or maybe it's just that more fiction revolves around ensemble casts rather than a single lead, a limited supporting cast, and featured guest stars. Though I think those two things might be interconnected.
I think part of it, though, is also just that we live in more public, more connected times. We post what were once private thoughts as live tweets and status updates, we post photos of our meals and selfies of the bathroom mirror... the younger generations just take that kind of open connection for granted, so it's reflected in today's fiction. Plus there's a greater awareness of the toxic side of lying to loved ones. A lot of the things superheroes do to trick their friends and families are tantamount to the gaslighting behavior of abusers, so it just doesn't feel right anymore.
Or maybe part of it is just that modern technology renders secret identities less credible, as illustrated by
this well-known cartoon.