The match against Madrid isn't one I think Madrid did take serious nd shouldn't be considered like one which AC Milan was actually superior to Madrid is and talking about Madrid's strong and firm squad, they weren't all present in that game, he only used a few of them and not the actual complete squad which he has selected to play this season (I mean his first 11). With Manchester city I believe similar thing did happened too because in that game Manchester city was seen with minimal dominance and that was really unlike them, the preseason games aren't one that should be taken seriously as the main strength of the trans will be seen when the season begins.
Usually clubs are taking these preseason matches not seriously because they are already having enough space for this but still going ahead for having some good practice to their newly recruited players because this is also important for them, but AC Milan is doing good job in these games as they are heading for the new season where things could be surely challenging because we are having few teams at their best and this could be not easy for them to stay at this level.
AC Milan is preparing strongly because now they are having some good targets for new season and their new players will be also able to give their best which will bring them in good situation for having good end of their next season while in last season we have good performance near the end of season while their start was not good hopefully now from start they will try to keep pressure for title race.