I know it’s daft to caution a 4 year old over this, but they are perfectly right in saying it’s illegal. It’s a pavement beside a road (and assuming it’s not a marked cycle path), so yes illegal.
Where do you draw the line though? There are tonnes of idiots, teens and adults, who blast down narrow pavements, round corners running into people (certainly had many near misses myself) as they don’t want to be on the road and likely because they have no lights when it’s at night. Public attitude would be hatred towards these types, yet when it’s a small child it’s the complete opposite.
Not saying I agree with the law one way or the other, though some pavement riders are idiots.