"Modern USB keyboards on desktops running Unix variants still do that in the terminal program."
It's not restricted to USB keyboards, in fact it's not the keyboard itself. The keyboard driver converts the key presses and releases into emulation of some sort of traditional keyboard input, typically that of the VT100 or one of its descendants.