Hi dummieX,
Since this issue seems to be isolated to the operating system (macOS doesn't recognize that your MacBook has a built-in keyboard, but your Mac's firmware recognized the Shift key being held down to boot Safe Mode), I'd recommend reinstalling macOS onto your MacBook. To do this:
1. Boot Recovery Mode. Hold down Command-R while you turn on or restart your Mac. Release the keys when the Apple logo appears. Startup may be slower than usual.
2. When the Utilities menu appears, select Reinstall macOS. (You won't lose any data.) Recovery Mode will download a fresh copy of macOS High Sierra, and will then proceed to install it onto your startup disk (thereby removing the previous OS). Your Mac may restart a couple of times. When everything is finished, you should end up at the login window or at the desktop screen.
Note: If FileVault is on, you might need to unlock the startup disk the first time after your Mac restarts. This can be done by logging into your account when prompted.
Hope this helps!