You are saying, “we don’t need to know.” But you/we are not our courts or legal system. You say her problems should NOT have been considered by the Court. That may be your feeling, but your feeling is not THE LAW, or the Constitution. Perhaps this situation would be clearer if you would read the Court Decision linked at Comment #1. If you read that then you will know more details. Note also that as a legal minor she has a Guardian ad litem to help her navigate what must be a frightening set of circumstances.
She’s illegal. She should be returned to Mexico. That’s my firm feeling, whether or not there is an involved legal train of argument that says otherwise.