I think this phenomenon is more commonly referred to as bouncing. And you are looking to debounce an input. (Switches bounce, and relays chatter)
It may be worth looking into libinput for debounce parameters/tweaking. They may be hard coded.
It's not something I've messed around with on a PC. It's common issue when reading the raw state of a button, as an input on a microcontroller.
If your keyboard has configurable firmware, it could be an approach too.