Part of this policy may be a desire for conformity and aversion to young rebels in dyed hair. But the Japanese are the most conformist, and in many ways overtly "racist" (no people are exactly equals ... all are either superior or inferior, in various comparisons) nationality I've ever encountered. So maybe in part also: straight black hair - good. Wavy or any color but black - acceptable for foreign or mixed race student who, unfortunately gomen nasai, can't help it.
“...and in many ways overtly “racist””
Perhaps, but China can hold their own too!
In any case, it is this ‘racism’ that protects them from losing their culture, and ultimately their race itself. So far it’s working quite well for them (other than their relatively slow population decline).