My two fens:
Guardiola decided to leave Bayern because Bayern could not offer him the total freedom he wants to implement his philosophy, concepts to make the team "a real Pep team". If you read the interview with Marti Perarnau, the author of "Pep Confidential", you get the feeling that Guardiola felt a bit disappointed with what he perceived as the failure to transform Bayern into "a real Pep team" mostly because of two things (1) Bayern management's and Bayern fans' utmost emphasis on delivering silverwares, more specifically, winning the CL and (2) the resistance, critique and sometimes accusations that Guardiola met and received for breaking some of the ground rules, virtues, culture and traditions of what is fundamentally considered German football.
With regard to (1), there is a disparity between what Bayern management and Bayern fans think what success looks like (winning the CL) and what Guardiola himself believes what success looks like (transforming Bayern into "a real Pep team") and he has lost his patience and confidence that Bayern allows him to do what it takes to achieve what he wants. Guardiola is a perfectionist, not that he does not want to win games, of course he does, but he seems to have attached great importance to not only winning the game but how the team should play. And Bayern can no longer afford him to continue to do that, he must have felt.
As to (2), no offense to you guys here, but according to "Pep Confidential", Guardiola was hired at least partially to "Barcarize" Bayern, if you will. He introduced or should I say further solidify what has made us so successful during his reign in Barcelona, possession, short passes and a dominating midfield etc. when he came to Bayern. But then he was also often reminded of not losing Bayern's German identity, so he has tried pretty hard blending the two together and during which he has received a lot of critiques from ex-Bayern big-wigs, managers, players, media and fans, especially the result on the field didn't look convincingly good. The man is tired.
I think his next destination is Manchester City, a place which doesn't carry a lot of traditions and baggage; a place with a ex-Barca man, Txiki Begiristain being the sporting director; a place with the rich owner, Sheikh Mansour who doesn't have any preconceptions about how football should be played; a place that he will have a lot of freedom that no other place, not us, not you guys can offer for him to do whatever he wants to do.
I am sure he will transform City into a even more fierce rival for all of us in the future. I hope one day he will return to us when he is done with coaching.