L-GALAXIES 2020: The formation and chemical evolution of stellar haloes in Milky Way Analogues and galaxy clusters