I understand what you are talking about. For me, there is nothing wrong with Xabi Alonso coaching Bayern Munich next season because Bayern Munich and Bayern Leverkusen are not on the same level. Xabi Alonso's good performance at Bayern Leverkusen is for him to get a bigger contract from big clubs, which is already working out for him.
That's right, it was legal when Xabi took over the coaching chair of Bayern Munich, because Bayern Munich is also one of the teams that can compete in bigger competitions, such as the Champions League. However, if Xabi thinks the same thing as me, then he can stay at Leverkusen, because Leverkusen itself is certain to get a place in the Champions League next season. That way he can show that he is a coach who can really compete, he has to prove that because so far many people have said that this is Xabi's luck.
However, if he wants to leave, that's not a problem either, because this is also an opportunity for him to be in a bigger team considering that there are so many teams who want to work with him next season. Names like Liverpool also appeared, because Liverpool itself was certain to be abandoned by Jurgen Klopp who chose to resign, even though Liverpool still really needed him. So Xabi can take the opportunity to manage a team in a more prestigious league.
Actually, it could happen, but it doesn't make sense if Xabi Alonso would leave Leverkusen and join Bayern Munich just for the reason of wanting to gain achievements or experience in bringing the club to the Champions League title.
Leverkusen and Bayern Munich are popular clubs who are very wise in making decisions and Bayern Munich's management will not easily trust a coach who has just achieved good results in the Bundesliga, while Leverkusen will also not let Xabi move to Bayern Munich because it could endanger the competition in next season.
It would make more sense if Xabi moved to another league, such as the Premier League, to join Liverpool, although there is no guarantee that he will gain good experience as a coach, but at least that is a more sensible choice.