Use of kT for energy of a wave?

The energy of $$\frac12kT$$ for each degree of freedom of a particle from statistical mechanics was derived from particles, and yet Rayleigh and Jeans just nonchalantly said let's borrow this and apply it for the energy of waves as well. What was the climate around the time surrounding the physics community that would've let them get away with such a thing? Was this notion that $$kT$$ is universally applicable already deep seated in the community even while Maxwell was hard at work on his theory? If so where did it first arise, and what was the justification for it?

• Are you talking about the equipartition theorem in the Rayleigh-Jeans derivation of the "ultraviolet catastrophe"? I think it was applied to Planck's oscillators rather than to waves. – Conifold Apr 11 at 1:51