This scenario is a form of close inbreeding. In nature, it is rare and usually prevented by mating behaviors, social structures, and biological mechanisms that reduce the likelihood of reproduction between close relatives.
Close inbreeding increases the risk of genetic disorders and health problems in offspring, which is why responsible breeders avoid pairing closely related dogs.