I'm finding the argument that Allegri handed the game to Pep and Bayern to be incredibly lazy analysis. It's simply not true.
Allegri tactically outwitted Pep for the first hour of the game by having Juve use two key phases of defensive play, in order to nulify Alonso and the default Pep tiki taka style.
First of all, Juve pressed high and hard from the front, swamping Alonso out of his deep lying playmaker position, sometimes having a diamond quartet of Juve players surround him in order to cut him out as a passing option. When he did receive the ball, he was often influenced to play the ball backwards, because he didn't have the pace or skill to progress forwards while being double or triple marked. This meant that the ball was often forced to Bayern's less influential centre backs, who were rushed into erratic passes and long balls, due to Juve's pressing. Hence Juve kept winning the ball back high up the pitch in the first hour.
Second of all, when Bayern DID manage to progress into the Juve half via short passes through central midfield, Juve dropped deeper, often double marking Ribery and Costa in wider areas, while flooding the zone 14 part of Juve's half (the D area of the penalty box, up to the sides of it touching the penalty box corners and just in front of it, where statistically most goals are scored and created). They allowed Alonso and Bayern's defenders as much time on the ball as they wanted, but it didn't matter because all of their passing options were cut out, meaning endless sideways passing without penetration. Even Ribery was forced out of position to collect the ball and try to influence the game. It made no difference.
Meanwhile, Juve always had the threat of Morata, Pogba and Cuadrado on the counter. This was another area where Alonso was struggling, with his lack of covering pace. Bayern were 2-0 down after 60 minutes and Pep was in big trouble.
That's when Pep changed the game, subbing Coman on for Alonso and moving Costa to a central position, while also making his team go more direct, looking to dribble from deep and cross balls into the Juve box.
Juve's high press was completely bypassed by Costa's brilliance through the middle of the pitch, where his short bursts of pace and sharp turns took out several Juve midfielders. This was aided by Ribery and Coman keeping the pitch wide and offering their own threats on the break. Juve were forced deeper and deeper, surrendering more dangerous territories of the pitch (read: zone 14 and inside forward positions), allowing Bayern into their area with direct play. They couldn't keep possession and were forced into long balls, where Morata was isolated high up the pitch and marshalled effectively by the Bayern centre backs. He was taken out of the game for those 11 minutes, becoming a non-factor.
Allegri had to make a change in order to get a grip on the game. He couldn't afford to allow Bayern so much possession for another 20 minutes against his tiring team, who were becoming more susceptible to mistakes while being forced deep, especially when Bayern had incredible guile on the pitch. Hence bringing on Mandzukic, who is a better long ball option. It made a slight difference in terms of having an out option, but it didn't stop Bayern exposing Juve in dangerous areas. The substitution was not to be blamed for the concession of two goals, although Allegri could have tried to bring on an extra midfielder to help protect the edges of Juve's area.
Going into the first half of extra time, Juve started to get a hold of the game again, with Mandzukic finding joy by holding the ball up in wide areas, taking pressure off the defence and allowing Juve to push higher up the pitch. Mandzukic also created by far the best chance in the first half of extra time, cutting back to Lichsteiner who was free in the box and should have scored. The game was even again, until Pep made his next sub.
By bringing on Thiago Alcantara for Ribery while switching Costa back out wide and returning to a short passing game, Pep was able to expose Juve's tired legs with a quick short pass and move game, pulling Juve apart, with some players able to press while others only had the legs to retreat deep. This created large central spaces for Bayern to operate within, eventually finding joy in zone 14 for Thiago's goal. An exhausted Juve were forced to chase the game late on, which led to Coman's goal on the counter, again in zone 14 which had largely been abandoned due to a loss of shape via desperation and tiredness.
Pep deserves a lot more credit than he's receiving for turning the game around (although he should with his wealth of options), while the criticism of Allegri for "blowing the lead" is over the top. Bayern and Pep simply found a way to take the game by the scruff of the neck on two occasions, where their superior class showed against a lesser team who ended up becoming knackered from spending most of the game chasing after the ball in an aggressive manner.
This is also ignoring the factors of Juve missing great chances to wrap the game up in the original 90, plus having other outstanding chances in extra time. But I don't know if that's even allowed to be up for discussion when simplicities such as "Mandzukic for Morata changed the game" are actually written with straight faces, while so many other nuances are ignored. Maybe there is an argument for subbing off someone else for Mandzukic, but surely that would mean conceding even more central midfield territory, which was already a huge problem for Juve at that point. Regardless, I think it's a shame that people will nitpick decisions that were largely irrelevant (positively and negatively) to the flow of the game.
TL;DR: Some people needed to play closer attention to the game.