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.