The lesson being: be normal and normal only, otherwise you will be made so, through intoleration, discrimination and
assimilation. Public school system is for average people, and I don't mean anything hostile saying that. You are, on the base of your story here, above average in your intellectual capacity, and don't need to go through the chores others need to go through to succeed your class. There's nothing unjust about that, and your gift. Just like some people are more attractive, you're smarter.
I've been through similar situations (tho my breaking points have been more often and exaggerated) and quite quickly I've learnt to quack like an average guy, and to walk like an average guy, but to not be one, in school. I've always been a step ahead from my peers in learning quickly and in investing minimum time to get maximum output from my studies. So I just went to school and acted like the next guy, and did whatever I wanted (whatever being programming, literature, philosophy, etc.) in my spare time.
There is no justice in this, as the headmaster of your school said to your parents, some are just naturally more inclined to apprehension. Furthermore, some like doing it more than others. But sometimes educational staff feel the need to normalise the outliers, because they believe that the rest will believe that them themselves are idiots and won't engage. So they confine those outliers, the smarter ones, to normality, to the average, sacrificing them for the rest. Not only are their assumptions wrong, but the effects may be really bad on the students, dissuading them from exploiting their gifts in the future.
Some people are better at learning. Others are better at other things. Do we break the noses of very good-looking students in the school because they have unjust advantage in getting into relationships? Do we somehow shorten taller students because they score more baskets that the others? Do we deflate the breasts of more bustier students because other girls may get jealous of them? I'm sorry if I sounded a bit harsh and immodest. I don't claim that some are better overall than others, but they are better in some treats. But in situations like in your anectodes and in many experiences I myself had as an outlier, I've seen that this sort of practice leads to a missionary of reducing everybody to the lowest common denominator with regards to educational abilities, rendering public schools futile.