it was definitely in practice pre-ww2. The schools my grandparents attended are still around (Taiwan), still same traditions 🥳
I looked it up, that style school system was established by the Meiji (1868) government modeling European (German/Austrian?) school systems -- to bring Japan into the modern era and establish their empire