Hi Morgana,
Thanks for the FDK!
Well, first off, it wasn't the judge and Madge, it was all Madge.
The Judge had reviewed the will beforehand, but there was no way to be sure that the Harrises had chosen wisely so DCF had to be on hand.
Once she saw the relationship, amply displayed by Carrie's tenacious hold on Clark she called Madge off. If the parents had not chosen wisely then CPD and DCF could have removed the child.