If so, it was a trick that *worked*.
Previous efforts to derive the blackbody emission spectrum using classical physics gave nonsensical results at high frequencies. Replace continuous emission with discrete quanta and things work out perfectly.
Evidence for the reality of quanta began with Einstein’s explanation of the photoelectric effect in 1905. The proposal that radiation of frequency f exists only in discrete chunks of energy E=hf was the first result of Einstein’s “Miracle Year.”