There was no such philosophy.
At least, no philosopher of any influence or note held such an idea. There was a considerable amount of thought put towards the identifying the sources of prosperity and the attributes of a good ruler. The Bible was an important source of ideas, both from the sapiential books and the accounts of David, Solomon, and other rulers. The political works of Aristotle were available to many, as were histories of Rome and local annals. Such works were read, discussed and glossed with substantially more care and discernment than most of what passes for political discourse today. In all of this, the closest to the idea being asked about are rather banal observations that a king's personal health often affects their decisions and ability to act.
But as noted in the comments, this concept was a very prevalent literary motif. Like any trope, the motif was useful to storytellers and myth-makers. And audiences seem to find it satisfying.