Why does the spool speed increase with altitude for a turbofan engine (single spool & double spool)?
As you note - as altitude increases, air density decreases.

The work done by the compressor stages therefore also decreases at any given rotational speed. If we assume constant power applied to the compressor stages (not entirely correctly) then the speed will increase until the work done matches the power input.

The overall work done by the engine will still decrease, due to decreased combustion, but the spool speed is going to increase a certain amount.