I'm not sure if he could really avoid that... Look at how much his genealogical tree was creepy:
True, but genetcis is a game of chance. The obsession with relatives so closely related was already receding, and it would really last ony a couple or three generations more, so the branch could have survived to the present day.
The rest of Europe's royal families weren't any better, after all, and most if not all of them are still alive. Even the Austrian Hapsburgs themselves, wich ware every bit as bad ase the spanish ones.