As a connoisseur of all things excellent in human thought and intelligence I cannot help but think that Hesse's "Magister Ludi" was inspired by Max Weber's sociological theories.
I know that there is no mention of the two great thinkers in the same breath let alone the same pages in any of the analyses I've come across but there are many parallels in thought of their writings to make me think thus. I would go so far as to say that the life of the character of Magister Ludi, Joseph Knecht, is the model of Max Weber in logical/practical consequence.
Hesse breaks down the reincarnated "lives" of Knecht into the three iterations: The Rainmaker; The Father Confessor; and, The Indian Life, which are uncannily in cognate with the three types of political leadership and authority that Weber wrote about: Charismatic (familial or religious); Traditional (patrimonialism and feudalism); and, Legal-rationalistic (bureaucratic and modern law and state).
Of the three Weber said that third was an "iron cage" in the "polar night of icy darkness" which I would suggest was a warning that Hesse took to heart in his writing of "Magister Ludi" who, in the novel, in the end rejects and repudiates the world of the Mind and empty, abstract idealism in favour of the world of the real where human struggles and achievements give at least the hope of "subjective meaning" to an individual's life.
"The favoured nobility (which Knecht belonged) has always basked in the sunlight; but from a certain stage of development on, its place in the sun, its privileged state, has always constituted a temptation and led to its corruption".
Weber was an antipositivist, which I take to mean that "the whole is always greater than the sum of its parts" - that human beings are not just physical but spiritual beings who will always reject and resist a merely rational-corporeal existence - for we are all want and need art, justice, and peace (and intellectual challenges) in our lives to actualize ourselves and be the best we can be.