In the US, there are no laws against surgical circumcision with informed consent (and I don't know of any such laws in any other country). Parents are generally allowed to grant surrogate informed consent. There is no requirement that circumcision be carried out by a licensed physician or other approved practitioner. A person can be held civilly liable for damage done by the procedure. There are no criminal prohibitions in the cases that you describe, but there could be civil interventions. In particular, the court could override parental consent – for instance, if a parent ordered circumcision of their 17 year old.
If some person does the circumcision without parental consent, that could be a crime. The key distinction is parental consent. The law grants parents the power to act on behalf of the child, under the premise that children do not have the capacity to act in their own best interest, and cannot reasonably be forced to bear the full consequences of their actions. JustThese are long-standing pre-common law premises, which even predate the promulgation of English common law. "Best interest" is not a technical term requiring definition, but it is a factual matter that is very difficult to judge. Judges use solomonic wisdom to determine whether a surgery is in the best interest of a child when it is medically advantageous but psychologically detrimental. Just as an adult can consent to a circumcision thereby negating any accusation of assault, so too can a parent consent on behalf of their child.