Hi, i hope you're doing good today.
I had the problem and fixed it easily, it might not work in all cases but worked for me.
I only had to change the input language to English US from English UK, by right clicking the icon that was for some reason on the right of the task bar.
I looked into it further and there seems to be a language bug.
For me when i changed the input language the lag on the keyboard was gone while playing games, but the Keyboard layout was wrong for some keys like the @ symbol had switched with the " symbol as expected.
However when i rebooted the ENG (language icon on right of task bar) was gone and the settings were english uk again and the lag was still gone.
if you cant see that icon you have to change the it language in settings, you can also try to add an language you dont want,( like English US ) then delete it, that could also help.