Maybe era kanjis should be encoded in a systematic manner similar to flags. The EU flag is encoded as <Flag letter E><Flag letter U>, the new era would be encoded like <JP era number 2><JP era number 0><JP era number 1><JP era number 9>.
Or they could just have era1=Meiji, era2=Taisho, era3=Showa, era4=Heisei etc. since Japan only had 4 eras named that way so far (and past era are pretty much not changing).
Then era1-era0 for the 10th era. Much simpler than building from the Gregorian year.
By building from the Gregorian year, you can convert the Japanese year to the Gregorian one without needing updates when a new era begins. I dont know how useful that is in practice though.
Otherwise you can just reserve a range of codepoints for era names.
Except that Japanese eras actually go back to approximately 645 AD, and some emperors reigned through multiple eras and others shared eras (Emperor Meiji himself began his rule in Keio year 3, and it wasn't until Keio year 4 that that era ended and the Meiji era began). Your scheme only works for modern eras rather than the full span of them.