Used to be people never moved more than ten miles away from their small isolated villages. Lots of cousin marrying going on for millenia.
First cousins only share 1/8 of their genes. Second - is that the children of first cousins marrying? - would share 1/32.
You can have dangerous mismatching of genetics between total strangers. Certain genes, if shared by both parts of a couple, will make it hard for them to have children or have healthy children. Yet they are not related in any recent generation.