I was in a similar situation to OP: my Carbon X1 Gen 8 keys, notably `/` and some arrows keys, stopped functioning. Sometimes they did, but it was very erratic.
Luckily, when I replaced the battery (got a lot from iFixit) and tightened all other screws, the keys magically started working again.
Saved me quite a few dollars.