"Illegal" and "breaking the law" are rhetorically powerful, but less impressive than they seem. There are lots of people who are "violating the law" and subject to consequences for doing so, despite having never committed a crime, never having committed a tort, never having interfered with or trespassed on someone else's property, and never having breached a contract.
A minor present in the U.S. who is not a citizen and not subject to a valid visa and has no valid claim to asylum is "deportable" because the minor doesn't have legal authorization to be in the U.S. Being "deportable" authorizes a legal consequence as a result of one's legal status, but it doesn't mean that you personally did anything wrong.
Someone who is deportable can be detained in an immigration jail pending deportation for a limited period of time. But, this is civil detention and not based upon personal wrongful conduct, it is based upon your legal status. It is analogous legally, to being placed in a Japanese internment camp during WWII due to your Japanese descent even if you are lawfully present in the U.S., when war powers authorized the detention notwithstanding a lack of any personal or particularize fault of those detained.
In the same vein, being born causes you to acquire multiple forms of legal status. You are the child of at least one person, usually two people, and sometimes more. You acquire citizenship and nationality which has certain legal consequences. You currently reside somewhere and being a resident of a place often has legal consequences (e.g. frequently, government benefits and rights to use public property). You gain intestate inheritance rights from lots of people. Through no fault of your own you gained various legal statuses and that had legal consequences. When you legal status changes, the consequences of your status changes, and this can happen entirely without fault. Children in particular often have legal rights in an immigration context that is mostly derivative of the legal status of their parents.
But, this legal status of the minor doesn't have to arise from any affirmative law breaking act of the minor. For example, the minor could (and often did) enter the U.S. in the custody of a parent pursuant to a valid temporary visa or a valid permanent visa subject to revocation, that is then revoked due to an action of a parent (e.g. committing a deportable crime) or inaction of a parent (e.g. failing to leave the U.S. when the visa expires) that the minor did not participate in at all and had no personal legal duty or ability to address.
Similarly, criminal liability for an immigration offense (which is the exception and not the rule) requires a certain amount of mens rea (i.e. intent) which a young children who accompanied a parent into the U.S. could totally lack. The child may not even know what a national boundary is, which country he is currently in, or what citizenship or lawful presence means under the law.
Further, a child has to have the ability to not break the law to have criminal liability in most cases, but is subject to the custody and control of their parent or guardian and has no choice regarding where the child travels or where the child resides. This is particularly obvious in the case of an infant, but legally the concept applies to any minor who is not emancipated.