This is so NOT a solved problem.
I was having this issue with a magic keyboard with number pad. I figured it was a hardware issue, so I swapped it for an extra I had lying around. Same problem.
Every few minutes, my keyboard will start to glitch, popping up the special character menu you get when you hold down on a character (to get accents & etc). It will also start inserting a bunch of spaces. If I try to delete, it will backspace like 40 times. Massively frustrating. Cycling keyboards off and on definitely does not work.
Tried resetting the Bluetooth module. Will see if that works.