If it works for external and onscreen keyboard, this is hardware issue. The timing is just a coincident in this case. If it is driver issue, it should also affect external keyboard. Driver issue also affects the entire keyboard, not just a few random keys. Or it affects the function keys, not regular letter keys.
Underneath the keyboard, there is a circuit board with numerous signal tracks. Cracks in the tracks, dust or debris buildup, or corrosion can disrupt the signal flow. Microcrack's symptoms can slowly show up over time.
Your next step is to contact computer manufacturer support, or bring the computer to local repair shops.