Seems like a chicken and egg scenario. Way I see it we lived in caves for a long time. Long enough until someone got old enough to get smarter than the average cave dweller. Probably the same way with outrunning dinosaurs. The youngsters kept running away but got caught and ate until one day one of them managed to survive long enough to get a brain and say there has go to be a better way