I doubt Ash is leaving the show.
Here is the thing: A new protagonist will also have a Pikachu as its mascot and starter Pokemon, simply because Pikachu is the Franchise mascot.
The new protagonist will most likely get the same popular mons Ash has, especially in terms of starter Pokemon (So that means the OG Kanto starters, Typhlosion, Sceptile, Infernape, Greninja). But now they have given Ash a Lucario, Dragonite and Gengar and the new protag would also get them, because they are popular. You can make a similair case for the likes of Krookodile and the Kalos Squad (All of the Kalos mons Ash owns are in the top 6 popularity from their region, only Aegislash is higher up than Noivern, Hawlucha, Goodra and Talonflame).
The only thing i can see them doing if Ash becomes a Pokemon Master, is to still let him stay on the show, has a side battle goal (Doing tournaments) and perform a mentor role, because that way, they don't have to give the new protagonist a Pikachu (Which means the new protagonist will most likely have an Eevee).
This way, they can also keep Team Rocket on the show, since replacing Ash, also mean replacing them (And Jessie and James are the secondary human faces for the anime, while Meowth and too a lesser extent Wobbuffet are the secondary Pokemon faces of the anime), because it makes no sense to have Team Rocket without Ash. The other way around also holds true - it makes no sense to have Ash, without Team Rocket. Their stories have basically been intertwined with eachother at this point.
The only time there was a gap to replace Ash and Team Rocket, is after the OS (With Ash winning the Johto league in an epic finale against Gary). Then they potentially could have made a time jump for the Hoenn anime and have a potential child of Jessie and James be the new main protag for Hoenn and Sinnoh.