Keyboard/touchpad no longer works in OS X. Works fine in Linux. 13" early 2015
EDIT: It turned out to be water damage that caused the issue. Fiddling with the case probably shifted some leads inside the computer that had shortened/lost contact.

So I think I've finally found the problem; the bottom of the case wasn't on properly.

The keyboard/touchpad would sometimes work, but after putting it in my bag and taking it out again it would usually not work anymore. However, after turning it off by holding the power button and carefully squeezing the case along the edges it would work when I powered it on again. The Macbook provides the ground connection for the keyboard via the bottom of the case, so my guess was that there was a problem with that connection.

So I took off the bottom of the case, cleaned it, and put it on again, careful to screw it in exactly straight, and now it seems to be fine.

I still don't know why it would work better in Linux. My only conjecture is that Linux can somehow reinitialize the hardware after it has lost power briefly.