As far as I know, the history of the black-body spectrum was as follows: Planck has been interested always in the fundamental questions, and one of the most pressing fundamental questions was that of the black-body spectrum since it was known from quite some time (~mid 19th century) that it is a very fundamental spectrum, independent of the material of the cavity that can only depend on fundamental constants. Planck made his name with the foundations of phenomenological thermodynamics, particularly a clear theoretical definition of entropy. He was quite sceptical against statistical methods a la Boltzmann first. In any case it was natural for him to study the black-body-radiation problem, and so he did from the 1880ies on. His trick was to use the independence of the spectrum from any specifics of the medium the cavity walls may consist and just using a single harmonic oscillator coupled to the electromagnetic field and asking for the thermal-equilibrium conditions between radiation and the oscillator (coupled to a thermal bath).
The breakthrough came, as almost always in physics, with high-precision experimental data by Rubens, Kurlbaum, et al from the Physikalisch Technische Reichsanstalt, who wanted to measure the black-body spectrum over a wide range of wave lengths in order to create a "normal spectrum" to compare light sources with it to have an industrial standard for various such light sources (particularly the upcoming electric ones).
First Planck investigated completely phenomenologically, how the spectrum (i.e., energy density per frequency or wave-length interval) should look, and he interpolated between the Rayleigh-Jeans and Wien's law, introducing the fudnamental constant, now named after him, the Planck quantum of action. He got what's also named after him, the Planck spectrum. Of course, as a theoretician that was not a very satisfactory state of affairs, and he wanted to derive his radiation law from the first principles of electrodynamics and thermodynamics. To that end he finally adopted the statistical methods from Boltzmann (on the way also writing down the famous relation between entropy and number of microstates, making up a macrostate, ##S=k \ln W##, which is now engraved on Boltzmann's tombstone). The trick was to introduce an equidistant grid in (radiation) energy and counting the ways to distribute such portions of energy of radiation over the frequencies to get the given total (average) energy due to the temperature of the cavity walls, equilibrium being defined by the maximum entropy in accordance with the corresponding constraints. As it turned out, to get his formula he had to assume that the "energy quanta" are proportional to the frequency of the em. radiation with the proportionalit constant given by his quantum of action. Of course, the original plan was to let the energy quanta go to 0 at the very end of the calculation somehow to get into accordance with good old classical electrodynamics, for which the exchange of energy between the em. field and charged particles should be continuous and not in portions dependent on the frequency of the radiation. He tried so till the end of his life, but as is well known, what he discovered was the end of classical physics and the beginning of quantum theory, with Einstein the next player in this story.
Nowadays it's clear that the black-body radiation formula is indeed a direct hint at the quantization of the electromagnetic field, but in another way than Einstein thought. The discreteness of the absorption and induced emission is due to the quantization of the charges bound to the medium, as became clear with the elementary treatment of the photoeffect with modern quantum theory using first-order time-dependent perturbation theory. For this part the classical treatment of the em. field is sufficient, but as Einstein has found out in 1917, to get Planck's radiation law right from a kinetic approach one has to assume that there is also spontaneous emission, and that's only possible to derive from first principles when the quantization of the electromagnetic field is taken into account (Dirac 1927).
So indeed first it was just a calculational technique used by Planck to count the distribution of energies to the fundamental modes of the electromagnetic field to be able to use Boltzmann's statistical approach to thermal-equilibrium distributions (maximization of entropy), but then it turned out to be the key to the discovery of quantum theory, i.e., that one must quantize the energy of the radiation field in the way Planck did as a calculational tool, i.e., it's what's realized in Nature rather than a calculational tool, and to make the energy quanta arbitrarily small, i.e., letting Plancks constant formally going to 0 to get the "classical limit" doesn't work out. It's only a valid approximation of the Bose distribution for low frequencies:
$$\frac{1}{\exp(\hbar \omega/(k_B T))-1} \simeq \frac{k_B T}{\hbar \omega} \quad \text{for} \quad \hbar \omega \ll k_B T.$$
In fact it's of course the quantum limit rather than the classical one. The latter you get for the other limit, i.e., ##\hbar \omega \gg k_B T##, for which you can neglect the 1 in the Bose distribution. The two limits are the Rayleigh-Jeans and the Wien radiation law, respectively:
https://en.wikipedia.org/wiki/Rayleigh–Jeans_law
https://en.wikipedia.org/wiki/Wien_approximation