The globular clusters–stellar haloes connection in early-type galaxies