If you pay attention to the previous transfer market, Real Madrid itself did not take the opportunity to recruit the players needed even though we know from the beginning of the season they had problems in defense. Ancelotti was so sure he could solve the problem but in fact he failed because he did not have a number of players who could be used for important matches. The arrival of Xabi Alonso next season will be a turning point and Real Madrid needs to find a defender so that the team is much more solid and also congratulations to Barcelona who have become La Liga champions this season.
In addition to what you said, there are also other things that Real Madrid experienced this season such as injuries to their main players and the substitute players that Real Madrid have are also not good enough so that this has really made Real Madrid get nothing this season. I also hope that Alonso can bring more capable changes to Real Madrid next season because Real Madrid is a strong team that already has a series of quite good achievements until last season.
The biggest mistake Real Madrid made was being too confident with the squad they had (based on the success achieved last season). They went through the season without making any major breakthroughs in the transfer market, the result being that luck was not on their side.
Injuries to several key players made it difficult for Ancelotti to formulate a strategy because the quality of the reserve players was very low, making it difficult for them to compete with Barcelona. Alonso will try to overhaul Real Madrid to win trophies again, he also started to make big plans for next season, the arrival of Huijsen and TAA will make the defense area even stronger.