Schoolmaster should not be confused with headmaster. A schoolmaster is simply
a male teacher, especially in a private school (=one that parents pay to send their children to)
according to Longman, which also marks it as British English.
I do not agree with your interpretation of the lyric: schoolteachers are also disciplinarians, especially at lower levels, and especially on the "front line" of student interaction. Rulers in the classroom did not spend most of their working time measuring things, and if someone makes trouble on the playground, another may still threaten to tell teacher on him, and one is, or used to be, sent to the principal's office only after the teacher had deemed classroom discipline to be inadequate.
Master itself has an old-fashioned meaning of teacher; the OED has it going back to Old English, probably from the Latin magister:
A man to whose care a child or children are committed for instruction, esp. in a school; a male teacher or tutor; a schoolmaster. Also: a male teacher of a particular subject; chiefly with distinguishing word, as dancing, French master, etc. (see also the first elements).
Þa befæsten hi hine to boclicere lare, and he wearð þa swiðe næmel þurh þæs halgan gastes gife, þæt on litle firste he oferþeah his mægster on wisdome.
But we do still use master to refer to teachers of specialized practices, as in master and pupil of sculpture, or kung-fu, or the Sith Code.
The headmaster is thus the head teacher (just as principal is a shortening of principal teacher), and indeed head teacher or head [of school] is the more common terminology in modern schools.