That's kind of the modus operandi of physics, I suppose. Max Planck started from a specific conclusion, that the spectrum of the Sun is limited at high frequencies in ways that Maxwell's theory clearly is not, and then searched for some way to explain the difference.