The described problem is not related specifically to the Japanese key board - you can demonstrate the same thing with the English keyboard.
It's related to the order of events. On keydown, you see the event but at that time the input.value has not been updated by the system. So when you write 34 into the value, subsequently the system sees a keyup and at that point writes the key into the value - concatenated to any value that is already there.
So, if you listen for keyup you will get the result you want, the system will have put the pressed key code into input.value, you will then overwrite it with 34.
var input = document.getElementById('test');input.addEventListener('keyup', function(e){
input.value = 34;
})
<input id="test" autocomplete="off" inputmode="numeric"/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…