How could youtube avoid this without verifying everyone's age?
They 100% know they are advertising to some children, even if just by mistakenly mislabeling children as older in rare cases. That's impossible to prevent through probabilistic means, so by implementing such systems they have accepted such an outcome.
That's the problem.
They know based on usage patterns. They know what age groups watch which videos. They use it to target children.
But because they didn't explicitly collect it, they can skirt the law.
The intent of the law is being ignored for profit.