Hard cases make bad law.
Could not the state intervene just as temporary guardian, to get the surgery done, then relinquish care back to the parents?
I suppose by doing so they risk the possibility of the parents failing to seek medical care for other serious things (diabetes, head trauma, cancer. . .)
on the other hand if the don’t they risk foster care, which is statistically very much not in most children’s best interest.