There was a post over in r/history about Charles the Mad of France and his delusion that he was made of glass.
Following a reasonable account of the illness, someone posted in a followup "was it because of the inbreeding?"
And I was just saddling up the high horse to lecture them that not every European monarch for all of history was an inbred mess, but I realised that I don't actually know what the deal is here.
Charles the Mad was the product of a degree of inbreeding. His maternal grandfather and grandmother were related, and through those dual connections to the French royal family his mother and father were also cousins. And the Burgundy branch connections in his mother's side were also related to the Valois line. I would note his illness was probably inherited from his maternal grandfather, and so incest may not have been a major factor, although it tends to raise the chance of inherited diseases being passed on.
In my understanding, the inbreeding in the French monarchy was more of a tactic to keep accord between the many cadet branches and ducal siblings in their family, as well as maintaining control over the distributed lands and titles that branching involved. I think. France is not really my area. But it's similar to how the Hapsburgs, despite intentionally practising incest, did so not to maintain blood purity (monarchal blood from other families was never a problem for royals as long as it was good royalty) but to maintain the alliance between Spanish and Austrian branches. So I think that was the main reason.
And it's important to note there were actual papal restrictions on incest. The whole reason for the divorce scandal with Henry VIII was because Leviticus' brother's wife provision was interpreted as a form of incest, and so consanguinity rules had to be followed via a papal dispensation. So while it wasn't uncommon for monarchs to get consanguinity dispensations, there were actually rules and stigmas around inbreeding. It wasn't universally accepted or freely encouraged.
In my understanding, overall the main reason why incest became a common problem for royal families (and I would note that word, became is relevant here) is because the list of acceptable suitors was narrowed to a small range of monarchies and princedoms. And while the reigning families of those titles could change, often the new family was related to the old one. And all of these families were practising this same narrow mingling. Therefore overtime it becomes increasingly impossible to marry someone who isn't related to you somehow or another through some shared connections at some point. You might marry a princess of Bohemia who's main line has nothing to do with yours as, say, Duke of Schleswig-Holstein or something. But they might have a connection through their great-aunt to the King of Sweden who is also your ancestor through your mother or something. Hence why Prince Phillip as a scion of Greece-and-Denmark was related to Queen Elizabeth II in modern times, it's all one small pool. Queen Victoria was mother and/or cousin to most of Europe's royals.
This is what in biology is called a genetic bottleneck. A small population breeding only with itself cannot attain the same genetic diversity as a healthier, wider population, and will become more and more incestuous over time. It isn't helped when sometimes they seem to lean into it, to be remarkably nonchalant in marrying first cousins or repeatedly from the same family, but it would be difficult to avoid anyway.