How to determine the cause of MacBook battery not charging?
What steps should I take next?


There's only one step to take next:  replace the battery.


  Disconnecting the MagSafe causes the machine to switch off. Sounds
  like it's a dead battery, except that Coconut reports the battery as
  detected, in good condition, but not charging.


It's a dead battery.  Coconut battery can only give you a calculation based on the voltage it's measuring at the time you run it.  It cannot tell you how much charge is actually left in the battery.  There's no "electronic dipstick" to measure the capacity.


Fully charged MacBook Air turns off when power cord removed
Why does a 12 inch Macbook refuse to turn on with a lot of battery remaining unless it is plugged in?


Coconut battery (not a fan and I don't use it) doesn't provide you anything but "a moment in time snapshot" of your battery health.  Thing is, you can get this info right from the command line:

system_profiler SPPowerDataType | grep -i "charge information" -A 10


The problem is, it can't "see" dead cells.  

Algorithm to check batteries


Reset SMC 
Verify that your charger is being detected (green/amber light)
If charger not detected, verify charger/dc in board.  Do this by 


checking for "gunk" then plugging in a known working charger.
If it works - it's your charger
If it doesn't work, it's your system (chances are, DC-In board)