An uncontained gas would never cool

In thermodynamics, an adiabatic process is one that occurs without transfer of heat or mass of substances between a thermodynamic system and its surroundings. In an adiabatic process, energy is transferred to the surroundings only as work.

I still don’t get why ‘friction’ would slow down a photon instead of just changing its energy.

If we’re talking about photons, then yes, you could (in principle) have some sort of phenomenon which redshifted them while still being frame-invariant (though no good evidence has ever been found for this). But for massive particles, it wouldn’t work.