I don’t think you actually want legislation that dictates a child’s ears cannot be pierced until they are old enough to decide.
I actually do want such legislation. I see permanent, cosmetic (i.e. not for medical reasons) body modifications as something which parents should not be allowed to perform or have performed on their children without informed consent from the child.
Such practices come in many forms, including ear piercing, male circumcision, and female genital mutilation. While the relevant age necessary to give consent should probably vary between these practices, in principle, these should all require informed consent. What one does to their own body is their business, but a child’s body belongs to him or her, not his or her parents.
We actually have such legislation banning female genital mutilation under the age of 18: https://www.law.cornell.edu/uscode/text/18/116