Such sad and tragic circumstances, my sympathy to all involved.
I do not know the specifics of English law as it applies but I believe it is similar enough to New South Wales, Australia that the general overview that follows is not likely to be far wrong.
Before a court intervenes there has to be a dispute and someone with standing must bring an action to the court. We can surmise that a dispute arose about the best medical treatment for the child between the child's parents and the child's medical professionals - if there was unanimity there would have been no legal proceedings.
Ultimately this is an issue of the welfare of the child. Medical professionals are under a legal obligation to report issues of child welfare to the relevant authorities. In the UK, the government authority responsible for child welfare is the Department of Education. We can presume that they intervened in accordance with their policies and procedures and their understanding of the law and the dispute could not be resolved. It is likely the DoE that brought the matter to the courts or the parent's disputing a DoE decision.
The court will decide such issues in the best interest of the child. In deciding what that is, they will consider all the evidence including the parent's wishes, the child's wishes (not relevant in this case but it can be for older children), other relatives, medical opinion etc. They will also consider what the law is, including precedent and make their decision. If you read the linked article about the high court trial the judge is quoted as saying:
“It is with the heaviest of hearts but with complete conviction for Charlie’s best interests that I find it is in Charlie’s best interests that I accede to these applications and rule that GOSH may lawfully withdraw all treatment save for palliative care to permit Charlie to die with dignity.”
“I dare say that medical science may benefit objectively from the experiment, but experimentation cannot be in Charlie’s best interests unless there is a prospect of benefit for him.”
“Charlie’s parents have sadly but bravely acknowledged and accepted that the quality of life that Charlie has at present is not worth sustaining, for he can only breathe through a ventilator, and although they believe that he has a sleep/wake cycle and can recognise them and react to them when they are close, they realise that he cannot go on as he is lying in bed, unable to move, fed through a tube, breathing through a machine.”
“Understandably, Charlie’s parents had grasped that possibility, they have done all they could possibly have done, they have very publicly raised funds. What parents would not do the same? But I have to say, having heard the evidence, that this case has never been about affordability, but about whether there is anything to be done for Charlie.”
“But if Charlie’s damaged brain function cannot be improved, as all agree, then how can he be any better off than he is now, which is a condition that his parents believe should not be sustained?”
This decision was reviewed by the European Human Rights Court who “endorsed in substance the approach” taken by the British courts and declared “the decision is final”.
Is it "symptomatic of a Single-Payer healthcare system"
Almost universally, child welfare cases are decided on the "best interests of the child". This judge in this case within this legal and cultural system decided as he did - and I do not doubt that it was a difficult and emotional task. Change the judge, change the case, change the law and change the culture and you may change the decision but, then again, maybe not.
Perhaps in a place with a different culture towards health care, the medical practitioners would not have formed the opinion that the experimental treatment was not in the best interest of their patient and there would have been no dispute that required government intervention.
Governments can pass laws that impact the people in their jurisdiction. The UK government has passed laws that allow them to interfere in the normal relationship of parental authority. The UK government is not unique - all countries have such laws.
Further, the UK government controls who enters and leaves their borders and in what circumstances.
Did the NHS (or the hospital) take custody of the child away from the parents?
Almost certainly not - this was not a custody battle.
Or does the NHS get to decide upon the welfare of its patients once they are in the system?
Of course. Every medical professional/hospital/clinic everywhere in the world has a legal and moral responsibility to provide treatment in the best interests of their patients. They will get sued if they don't.
Why were the parents not able to take Charlie away on their own recognizance, like (presumably) adults can refuse treatment and leave the hospital?
Because an adult can decide for themselves, a child cannot. Other people have responsibility for deciding for the child and when, as here, people with overlapping responsibilities (parents and medical professionals) have divergent views, the government intervenes through executive or judicial action.