macOS Sierra identifies my external Microsoft keyboard as my MacBook internal keyboard
I finally figured out that there was a kernel extension named org.pqrs.driver.VirtualHIDManager from an old Karabiner installation that was running and causing this problem. It was in my boot volume at /Library/Application Support/org.pqrs/Karabiner-Elements/org.pqrs.driver.VirtualHIDManager.kext/. Removing org.pqrs didn't work while I was logged in, so I restarted into my recovery volume, mounted my boot volume, and used the terminal to remove the directory. Everything went back to normal after that.