So in this case the state is using what logic to remove parental rights? It can’t be to be “protected under the law” unless you view death as a good thing/best thing for the baby.
You could surely make the case that the state has an interest in protecting the rights of the child if the parents want to try some outlandish "experimental treatment" like setting him on fire or giving him a head transplant. Of course, that would still involve SOMEONE drawing a line between what constitutes a legitimate medical treatment and what constitutes deranged lunacy.
There is absolutely no reason for the state to prevent the parents from taking the child home in a case where no more medical intervention is proscribed and the child is inevitably going to die a natural death. I have said from the start that I would have no problem with Charlie Gard's parents removing him from the hospital at gunpoint -- and shooting anyone who gets in their way -- if the hospital refuses to release him.