Leaving Ancelotti is something real Madrid may not want to do at this time but just like Liverpool, a time will come when even the team can't help it but to let him go probably for purposes of resting, retiring or on health grounds, either way they are definitely going to have a point where he will leave the team and the team will get to capitalize on his legacy hence look for a replacement for him. Like you did mentioned, if they start scouting for a replacement now it will be a gree idea a d I'm very sure even if they start so early, they are still going to find it really difficult to get a perfect replacement.
A manager that will get them to win the UCL and la Liga at the same time with much ease, is someone Madrid will definitely find difficult to get because such a manager must be very experienced and on a very different level of performance than other coaches who handle other teams, he must have a really different mentality that is geared towards winning mostly and not just to head the team a d having to settle for less, Madrid typical suffered only one loss this season in the la Liga and another two in the champions league this season too.
I don’t think we are that far away from Ancelloti departure from Real Madrid, last summer there were concrete rumors that he was set to leave for the Brazil National team with which he also hinted that it wouldn’t be bad to go there and manage the selecaó. Perez did a U-turn and offered him a new contract extension although what I noticed was that it wasn’t for a very long term with three years at most added (included an option to extend). This to me speaks that Real Madrid aren’t at the moment planning anything way too long like other clubs commit with a Manager with an Ancelloti. Looking at this I think once the gaffer contract expires he might be leaving to Brazil.
The manager that comes to mind to replace Ancelloti at the moment in my opinion is Xabi Alonso. He definitely lacks the experience that Ancelloti has but his Aura will pave way for him to become the next Real Madrid manager. Something even tells me his rejection of offers from Bayern Munich and Liverpool this season and to prolong his stay with the Bundesliga club is as just to wait more for Real Madrid. It’s a huge risk but to me a good one, if he gets a stellar season like last season then he will be the favourite to take it. My other wild card will be the return of Zidane