Assembly of spheroid-dominated galaxies in the EAGLE simulation