Ancelotti is not leaving Real Madrid. That has already been concluded. He will continue to be Real Madrid's coach for at least one more season. There was not official offer from Brazil even. Madrid trust him for the work he's been doing and they believe if its best he keeps leading the campaign.
It is true that Ancelotti will remain with Real Madrid for at least another season. I don't know what his future holds, but he is a successful coach with Real Madrid. In addition, Real Madrid's trust in Ancelotti is still the same as before, but if they fail to win the title next season. So change of coach will also be very likely.
Real Madrid tends to expect their coach to be able to win titles every season and they also expect the coach to keep his team performing well throughout the season. This season Real Madrid failed to win several important titles, including La Liga and the Champions League. The Coppa Del Rey is a different title, but it is also the most important part for the coach to stay at Real Madrid in the long term.
Real Madrid really enjoys Ancelloti's performance, which is why they asked him to stay for another season. I think he will win another trophy before leaving the team. Ancelloti is a very good coach, in fact he's one of the best coaches real Madrid have in the team. There are many coaches in different teams who have been coaching a team that haven't been successful with winning trophy like Ancelloti.
Real Madrid will love their upcoming season because they have already purchased players and are in the process of doing so in order to add more players so that they may win more trophies.
Despite finishing 10 points below Barcelona, Real Madrid still has the prospect of doing better next season, so I agree with you. But to be honest, the club had too many issues this season, they were not at their utmost performance as before which could only explain the wide gap between it and Barcelona.
Let's see how the next season plays out, but frankly, it's a good choice for them to retain Carlo Ancelotti, there is certainly no good reason for them to part ways with him now. But the next season could shape a very good decision on this. This discussion here reminds me of Zidane, he did a good job in the club, if not for the lack of support and financial support, he could have made the club prouder.