Random-phase approximation for critical temperatures of collinear magnets with multiple sublattices: GdX compounds (X=Mg,Rh,Ni,Pd)