Genes, climate, and types of local foods play a role too, but widespread adoption of agriculture made diets rich in carbs and starchy foods possible, which isn't great for dental health, and the somewhat recent trend (last 200~ years) of highly processed foods that are softer and easier to chew means there's less mechanisms to deal with tooth overcrowding. This has been observed in children from hunter gatherer societies, raised on modern diets, having worse dental hygiene than their parents.