The Diverse Origins of Terrestrial-Planet Systems