What I've seen is a parent who takes her child to court thinking, "The judge won't sentence me to jail, at least not right away, if kiddo is along", only to find herself (or himself) sent to jail and the child taken by protective services (because the court has no other choice).
THAT I'll give you! Not a genius move for a parent to make while the risk of incarceration is looming. People do this all the time.