If you live in the USA, this has Terri Schiavo-energy all around. It’s different, I know. Terri was alive and braindead. This infant is gonna die. The court is sparing the infant pain.
But why would you keep a child alive to suffer? It’s like Terri in that the parents refuse to think about anyone other than themselves. That’s just cruel / terrible / bad.
First of all, there is no reason to believe that this child is doomed to a life of suffering. Palliative care has come a long way, and people with terminal illnesses can almost always be made comfortable until the end arrives.
Furthermore, Terri Schiavo was not braindead, she was in a vegetative state. When someone is declared braindead they are legally dead and will immediately be taken to the morgue (stopping by the operating room if they are an organ donor.)
Terri Schiavo could breathe on her own, so by definition she was not braindead. In the US, when someone is incapacitated their family is responsible for determining what medical care they would have wanted.
Schiavo’s husband determined that she would not want life support. The courts supported his determination because he was her next of kin. If her husband had determined she wanted life support, the courts would have supported that too. That’s markedly different from the decision making in the OP.