In a sharply written ruling, a Texas judge mixed law, history and pointed rhetoric to order the release of a detained child and his father.