I would guess this is some kind of bug/flaw/feature in QtSpim.
I wrote some code code to clear the input buffer in a loop until it is emptied, and it works way too well. I was going to have a loop that printed and emptied each character in the buffer, then printed a message saying it had done so.
However, this turned out to be overkill: merely doing one single read from the data transfer location is sufficient to cause clearing the input buffer between Reloads, so suggest you add this to the beginning of your code, maybe as the first two lines of main.
li $a3, 0xffff0000
lw $t0, 4($a3)
Once that's executed in your simulation, QtSpim seems to reinitialize the input buffer upon Reinitialize and Reload menu command. If you never read from the data transfer MMIO location during the simulation, QtSpim apparently won't clear the input buffer on Reinit & Reload.
I would venture that this issue is avoided in most situations, since all the simulation has to do a read just one character from the input buffer at any point in the simulation.
So what it takes to elicit this annoying behavior is that some characters are entered in the input buffer, but the program/simulation is stopped & restarted before reading even one character (and that the next program is using MMIO keyboard input).