Quoted By:
When it comes time to transfer your Pokemon to the next gen, the protag always says goodbye to them and the Pokemon float into the sky in bubbles similar to what happens to the protag in the Mystery Dungeon series.
They know the Pokemon is leaving to go to the another version of "themselves" and so they feel at peace with it.
Each protag inhabits the spirit of us, the player.
They inherently know this, although they know not what it is.
After their Pokemon are gone, with only their starter (or whichever Pokemon you leave in the game) remaining, the spirit of the player leaves them and they go on to form their teams again.
This is how come protag players appear in later games with their own teams as non-playable characters to battle.