Let’s start from Masafumi Mima’s tweet (The Sound director of Pokémon anime series). At one point he stated: this is not a continuation of pocket monster xy&z, it's a completely new Satoshi and Pikachu. The tweet says LITERALLY: “Sun& Moon is NOT a continuation of XYZ.” Just for this reason, the final episode of Pokémon XYZ has to be considered absolutely conclusive since there isn’t even the usual ending sentence “next time a new beginning” but it ended with “And to our own way” that gives me the idea of a free interpretation for what Ash and all the other companions will go down the road. They give us some hint to presume what happens next like the ending kiss and the baby's breath flowers (which mean everlasting love and they are used in weddings) you can imagine what this is going. The main series is really over (for now), bc S&M is only a NEW Pokémon anime, with a reboot of the protagonist who is strongly reminiscent of Ash.
The plot of the Pokémon TV series does not always follow a logical thread, moreover for primarily economic necessity, as you can understand by yourself, the Pokémon anime is in a bad situation which is caused by the same staff of the animated series, who completely ignored Shudo’s directives. As time goes by, the audience became gradually sick of seeing Ash that loses everytime and re-starts with a new journey, as if nothing had happened, instead of realizing his dream. Now writers are inclined to create series comparable to spin-off and it often happens without explaining it directly in the episodes of the series (which keeps going on without any explanation of these story changes). Concerning the Pokémon anime, a real continuity is ensured by the following main series: Kanto–Orange–Johto–Hoenn – Sinnoh–Kalos. By following the episodes of these series, you may notice that there is a plot progression in the aforementioned regions, thus also proving that there is a connection and a progression, indeed, among them. But now here I am going to explain the reasons why Sun&Moon and also B&W have to be considered a world apart, series not linked with the main ones.
S&M: The official manga of the 20th pokemon movie shows “SM Ash” remembering his past, and he is shown with the outfit of this movie. As we know the 20th movie is settled into a parallel dimension, connected to Sun&Moon.
B&W: At those times the reboot strategy was tried, at the begging of the series they said Ash was a 10 years old kid (so to confirm a regression of the character), but with the audience drop of viewings they tried to adjust the series with the cameos of Dawn and Charizard (adding Brock & Misty in flashbacks). This has caused a lot of confusion about where Black&White is linked with the series.
Moreover (to enhance my thesis even more) the endings of DP Saga and XYZ Saga have some scene that are marks of showing a crossroad of the story: the last shoots of Ash where Ash went far from the camera. Black&White and the Sun&Moon are reboot and parallel series that feature a regressed version of Ash, also differentiated from the original with a change of character design in order to attract young audiences. As well said by Masafumi Mima, “that’s not the same Ash of original series and he shouldn’t be confused with him”. In the Sun & Moon Series Misty and Brock have been shown with the original clothes they had, rather than their most recent ones, mainly because there’s no continuity between the series anymore. Their presence is simply a tentative to adjust the flop of the anime, badly echoing the first generation. As proof of this, before the airing of the these episodes a survey was indeed in which was asked “Which of Ash’s past companions, would you like to return for a cameo?”. At the end of the XYZ series we saw some small forms of protest by the same animation directors/writers. This tells us that even they haven’t an effective control of the anime, in fact the staff changes with each generation and given that Pokémon is a commercial anime where control goes mainly to sponsors such as TV Tokyo. Obviously they do not care about Ash and the storyline, they only interest is to cash with ratings and merchandising.