The cosmic assembly of stellar haloes in massive early-type Galaxies