Well, yeah, it turns out that both Real Madrid and Barcelona experienced it worse. The number of goals they conceded was 39 and 38, which is much more than Atletico Madrid who only conceded 30 goals and also Athletic Club who only conceded 26 goals. So, defense is indeed homework for both clubs.
This will be a priority next season because conceding more goals is not ideal because as far as we can see the defense of both teams is not going well.
Real Madrid itself has had problems in defense since the beginning of the season because a number of players they have are injured so it is difficult for Ancelloti to create a solid defense system this season.
The arrival of several players who have the best quality can help the team's overall performance and Real Madrid has done that because they move faster.
But it seems that for Barcelona there will be no significant changes for the defenders next season.