Hi, I'm having similar problems, same model MBA, telling me the battery is to be replaced, I did this, same symptoms.!!!
I then replaced the logic board with a known good one!! Still the same. Also exchanged the Power board, no difference.
So I did some digging found that the charging control chip may be faulty?
The supplier agreed to find a tested logic board & send to me, ariived today!!
Reassembled the MBA, guesswhat, still the same...............at wits end!
Any likely suggestions?
It will start with battery & power disconnected, power reattached starts without touching the keyboard, reconnect battery, remove power runs a treat, just closing lid, no shutdown, keep charged, behaves properly, back ay square one!