Accretion of extraterrestrial matter throughout Earth's history