I actually prefer when they're used as part of the world building and not necessarily as a plot device in the main narrative, but I don't mind when they do both. Granted the newer generations seem to put more of an effort to contextualize the legendaries in some form of storyline or progression like a sidequest, mostly because they seem to be using legendaries and mythicals as selling points for DLC or extra content, and at the same time, the move away from the third version structure means that they no longer do tease legendaries like Rayquaza and Giratina in Ruby and Sapphire and Diamond and Pearl, respectively, which I also really enjoyed.
The reason why I like legendaries being in the world like that, separate from the main narrative or any sidequest at all, while they may seem like they're an afterthought, to me it was one of the many things those games did that made the world seem so much more alive and bigger than it may have been in actuality. I remember when I first beat Diamond and Pearl, guides and spoilers and walkthroughs were not that common or ubiquituous, so I found the Turnback Cave completely by accident, and got to Giratina by chance. Since there was no rigid storyline or quest structure leading me to it, it felt like I had discovered a completely natural part of the world by existing in it and exploring it myself, and the mystery of the elements that were presented while playing lead to a sense of fascination that made me immediately invested and the whole experience extremely memorable.
The games also did a really good job at providing just enough lore bits to make stuff like that feel integrated in the world regardless of any association to a particular storyline, combining bits of lore drops like Pokedex entries and small pieces of information being given in some NPCs dialogues and stuff, with environmental and visual storytelling that felt satistying to analyze and become invested in, like Turnback Cave's entire vibe and isolated location, or Giratina's entire design paralelling the other, more contextualized legendaries of the trio Dialga and Palkia, leading the player to naturally infer a connection between them. Now that is just one example with Giratina, but that's the way it usually happened with me, with legendaries that were handled like that. And then of course once something like Platinum came out, that felt like more of a natural progression and extension of the world that was already set up in the base games, and it felt satisfying to get those questions that had naturally come from getting invested in the game's world answered, and the theories that had been born from that confirmed or given context.
Over the years however I do think they tended to neglect this part of the design more and more, so you ended up with a lot of legendaries that just felt disconnected from the world with no context whatsoever. I think the best example is comparing the way mythical events like Deoxys or Darkrai were handled in Gens III-IV, where they had whole unique areas and encounters with their own implied stories and context, fueling tons of theories and analysis, to stuff like Volcanion or Zeraora in Gens VI-VII, which were just given to you through the game's mystery gift systems and had little to no reference in the actual game beyond Pokedex entries. I think that was a huge shame that made those games feel smaller than they could have.
It's also true that like a lot of things in the franchise, a lot of if not the majority of the bespoke pieces of lore that are presented tended to get dropped by GameFreak or not followed through on. Gen VI I think being the biggest example where you had a lot of lore like Azoth or the Draconids or the relationship between Jirachi and Archie being quickly and quietly introduced, being developed minimally if that, and then never talked about again as they moved to Gen VII, which is frustrating, and I understand why it may lead to people thinking of a lot of stuff like this as an afterthough. What was there though, I did find highly interesting to explore and think about.
Now though, it looks like with the move to DLC based extra content they are going back to making an effort to have the legendaries and even mythical Pokemon be part of the actual world again, but at the same time because the expectations for content like this have gotten way higher, and because nowadays the way information is presented and divulged has changed so much, they're going with a more standard approach of giving you rigid questlines and linear side stories which have the legendaries as the focus instead of the looser more emergent approach of back in the day, so all in all I guess I think of the way it's been done currently as a middle point. I'm glad effort is being put back in, but I also think there was something unique and special to the old approach that could have been continued, and I hope it does at some point.