So maybe I should recast the condition as dW = -dQ. As the cloud is gravitationally collapsing, this will tend to increase its temperature. But it radiates as it does so, and hence there is no net effect on the temperature. (isothermal phase)Not quite. In the initial stages of the collapse is slow and the gas cloud is transparent. Sans radiation, the collapse would cause the temperature to rise. That it can radiate means the temperature remains fairly constant and fairly low (but higher than the background 2.7 kelvin).
Okay, so in the adiabatic phase, the gravitational collapse does increase the temperature.As the collapse continues, the density and temperature rise, particularly in the center. The cloud becomes opaque, starting in the center but the opaque region grows with time. The opaque cloud does not interact much at all with the environment, not even radiationally.