Because democracies were so rare that they rarely shared common borders. Greater number of them appeared only after WWII, and many of them recently.
I think that this claim is just pure PC BS, which idolized democracy and ascribes everything good to it.
I think that when democracies were tested by ancient Greek city states and city states in medieval Italy, they DID fight the wars among themselves.
Let's invade France.
Just kidding. I guess.
Regarding democracies you may be right - there haven't been that many for very long, so who knows. I would say though that democracies make it less likely that one will go to war against another, due to the open process of policymaking.