You have made a very important point in this match as I watched the match too and my opinion is not different from yours. Real Madrid seem to be enjoying huge luck this season which is why they are able to come from first half one goal deficit to winning the match. It also not cool that they conceded two goals in seven minutes interval because if a serious team scores them this way, they may not be able to get a win. But Madrid tried to get the three points which is the most important thing.
I don't think it's luck. The mentality of Real Madrid players is on a different level. I think Real Madrid players never seem to experience a decrease in spirit and mentality even though the opponent is leading the score. That's what makes them always worthy of being champions. I think Leganes played very well with 2 goals in 7 minutes. They even had some good chances that failed to be converted into goals. But on the other hand Real Madrid always has an answer to every problem. Even though they lose, in the end they almost always get the win or become champions.