You are right. Real Madrid's chances of winning the La Liga title are slim. Real Madrid will play 12 more matches this season. And they are 12 points behind Barcelona. Barcelona lost 4 out of 12 matches and Madrid winning all matches is unlikely. And so Ancelotti should now try to win the Copa del Rey title.
The best thing Real Madrid can do is to consider this season complete and prepare for the next season. Maybe that's why the news about Carlo Ancelotti comes out. Maybe that's why the news about Haaland and Real Madrid are coming out. I do not know. There is a problem there. And they need to do something to solve it. Despite having financial problems at the beginning of the season, Barcelona made good transfers. Maybe they might consider spending some money on the competition too. On the other hand, Carlo Ancelotti's biggest trump card will be the Champions League. If he's successful there, no one will care what's going on in the league this season.
I don't understand why only Carlo Ancelotti this season failed to deliver a trophy for Real Madrid, and then many assumed that Carlo Ancelotti had to be sacked and or Real Madrid needed a new coach. Because I think it would be normal if a coach fails to give a title to the team, but as long as the team still has good results and doesn't fall too deep then the coach is still in good judgment too.
But indeed, Carlo Ancelotti does not have a long contract at Real Madrid because Carlo Ancelotti's own contract will expire in 2024. So yes, Carlo Ancelotti does not have much longer to stay at Real Madrid, so this is a matter of a short contract and not about being sacked.