Quoted By:
It's hard to say for the games before Gen 7 since we never really delved that deep into how their Leagues were established or ran. In those games the League was just this ever present system that drove the player to go from one place to another and encounter a story as they did so. That's not to say there were NO references. If I remember right, Flannery was new to being a Gym Leader when the player encounters her, but it's not clear how she became one.
Gen 7 we didn't have gym leaders, yet we actually got more of a feeling on how they come to be from stories like Hapu's, Molayne's and Guzma's, and the establishment of their Pokemon League. With the Trial Captain/Kahuna system, there's clear rules and rituals with the Kahunas being trainers outright recognized by the Guardian Tapu of each Island while the Trial Captains have an age limit and succession is chosen by the trial captains as they come of age to retire.
For Gen 8, there seems to be a greater focus on the League and how it's run as a part of the main story. We know Chairman Rose runs the League from a business end and the League is an actual event this time with a start and an end. We also seem to be getting Gym Grunts for the first time ever, which could explain where the Gym Leaders come from. They each run their gym, but they have trainers they work with and likely groom to take over the role of Leader once they decide to pass on the torch.