"MacBook Pro Keyboard Repeatedly Typing '7' - Need Help: [...]The issue occurs in various applications, not just one specific program Has anyone experienced a similar issue? I'm wondering if this could be a hardware problem with the key switch itself, or if there are other troubleshooting steps I should try before considering a repair."
-------
Troubleshooting a Keyboard Key:
You might need to get this serviced. But try the following...
A. Try Safe Mode:
While in Safe Mode, try using this browser. In Safe Mode, login items do not run, and corrupt system files(i.e. caches) are intentionally reset as a way to fix issues.
- Boot: in to Safe Mode: [Hold Down: shift key upon boot].
- Log in: as same user
- Try: this once more
- Restart: the Mac Normally
- Try: this once more
B. Single-Out this User:
For troubleshooting purposes, try a new Administrator user, seeing if you do not get this occur while in it. Trash this user you've just created, once done. If you don't get the error, then it is only issue with the current user. If not, then it is an issue with the entire Mac, in which case you should reinstall the macOS. See below...
C. Reinstall the macOS:
Nothing would be deleted. It's just that items that have become corrupted or deleted, would be replaced or reinstalled back to where they should be. Go Here: How to reinstall macOS from macOS Recovery - Apple Support. Important: Be certain to create a backup of your Mac prior to performing the reinstall. That way, you can have something to restore from the Mac from, should anything go wrong with the reinstall. Once reinstalled, try this once more, seeing if you still get this error.
D. External Keyboard:
If the reinstall didn't fix it, then it seems to be a hardware error. What happens when you plug an external keyboard in there? See if this issue still pops up. Ask a friend if you may try their keyboard, if you don't have one, yourself. This adapter may be what you need: USB-C to USB Adapter - Apple