I wouldn't agree that the new contract has no effect on him, because I think it gives him a new confidence in the sense that he knows he's still good at what he does. Also, he is not one of those who play football only for money, but sincerely enjoys every minute on the field, especially when he plays for the national team. Euro 2024 will therefore be something where he will definitely want to be, regardless of the League of Nations result - because even winning first place in such a competition cannot be compared to the European Championship.
Yes, I am sure that Modric will play at Euro 2024 even if he leaves Real Madrid by then (although Ancelotti recently said that he would like Modric, Kroos and Benzema to stay at Real Madrid as their experience is indispensable). Modric has the same physique as Pepe - he is "dry" so the years have less effect on him. Modric is now 37, and Pepe is 40 and in the World Cup Pepe was one of the best in the Portuguese national team.