Both sides had already qualified for the knockout stages ahead of the match, but Bayern had not yet been confirmed as group winners and a 4-2 victory for second-placed City would have been enough to see the Blues leapfrog their German hosts.
In the end, with substitute Alvaro Negredo being denied late on by Manuel Neuer, City fell just short, but certainly they have made a statement about their credentials as they head into the last 16 of the competition.
Bayern made just two alterations from their 7-0 win at Werder Bremen, and while their potency was evident early on, the way they capitulated came as a considerable surprise.
"I hope we can see how difficult it is playing in Europe," Guardiola said.
"Sometimes things like this can happen and today it happened to us. That's our message for today - we have to learn our lessons from this.
"We have to understand what we did wrong and how difficult it is to always win, especially in Europe, so we are ready for the knockout stages.
"We have got to realise we can also lose a game. We are a great team, a super team, but we can also lose, because our opponents also play very well."
Reflecting on the display, Pellegrini - whose side next host table-topping Arsenal in the Premier League on Saturday - said: "I think it was a very important game for us.
"I said that Arsenal was a priority above this game, and I said it was very difficult to win here by three goals.
"But for our team it was a very important win because we felt we needed revenge for what happened in Manchester (when Bayern recorded a dominant 3-1 victory at City) because we played very bad.
"Winning here after being two goals behind is very good. I'm very happy."
Pellegrini appeared to suggest he had not realised City needed only a further goal to go through as group winners, which would - theoretically at least - have ensured them an easier last-16 draw.
When asked if he had not been tempted to bring striker Sergio Aguero off the bench with the score at 3-2, Pellegrini said: ''I was tempted if we scored the fourth goal.
"It was important to be first in the group but not the most important.
''It was difficult to score two goals."
The starting line-up Pellegrini selected for this game showed that he had been preparing for it with the Arsenal match also in mind.
The Blues' first XI showed seven changes from last weekend's draw at Southampton, with Joe Hart, Joleon Lescott, Javi Garcia, Jesus Navas, Edin Dzeko, the fit-again Silva and Micah Richards - who came off with an injury after only 15 minutes - being brought into it.
The likes of Vincent Kompany, Richards' replacement Pablo Zabaleta, Aguero, Negredo and Samir Nasri dropped out, as well as the suspended Yaya Toure.
And Pellegrini added: "I thought there was the chance for players to demonstrate why they are in the squad, and this was important."