There's a lot going on here, but there's a major part that seems missing. How the Bundesliga has beaten Bayern Munich, particularly last season. The teams that beat Bayern, in the Bundesliga, did so by going after them. Pressing them, breaking up the passes to the midfield. Not by having a strong final third and looking for an outlet. Mönchengladbach was perhaps the best example of this in the Cup.
"But the hosts needed just 80 seconds to open their account with Kone pouncing on a sloppy pass by Bayern's Alphonso Davies to beat keeper Manuel Neuer." Pressure on the backline started it off. They continued to put the pressure on Bayern and refused to let Bayern take back the momentum. Mönchengladbach never dropping back to their final third, despite Bayern having more possession.
In the first game with Villareal, their man-of-the match Giovani Lo Celso said "We knew that we needed to shorten the field for them -- they are a team that can't have spaces to work the ball. We played our game, we are a team that always try to be the protagonist and we had a lot of opportunities to win by a bigger margin." In short, Villareal pressed Bayern higher up the field, away from their goal. Villarreal vs. Bayern Munich - Football Match Report - April 6, 2022 - ESPN
Villareal, in the second game, attempted to hold back and defend, and almost gave it away. But after Bayern got the goal, Villareal went back to pressuring Bayern and got the break they needed. Villareal was successfull when they followed the blueprint of attacking Bayern further up the field, away from their own goal.
Bayern is very attack heavy, with the bare minimum of a midfield. Sitting back and waiting for Bayern to get the final third is a recipe for disaster. Successfully defeating Bayern is about pressuring the backline and getting the midfield in trouble before they're passing to the attack.