On the variational derivation of the thermal RPA equation