I don't think there's any specific "agreement" between the press and all famous parents not to take photos of their kids.
The Editors' Code, to which most of the mainstream media outlets are signatories, is here
IPSO Editors' Code
With regard to children, it says (Clause 6)
i) All pupils should be free to complete their time at school without unnecessary intrusion.
ii) They must not be approached or photographed at school without permission of the school authorities.
iii) Children under 16 must not be interviewed or photographed on issues involving their own or another child’s welfare unless an adult with legal parental responsibility or similarly responsible adult consents.
iv) Children under 16 must not be paid for material involving their welfare, nor parents or guardians for material about their children or wards, unless it is clearly in the child’s interest.
v) Editors must not use the fame, notoriety or position of a parent or guardian as sole justification for publishing details of a child’s private life.
The Guardian, which is not regulated by IPSO, has the same clause in its own editorial code of practice.
The Prince and Princess of Wales are aware of the interest in their children, because of their constitutional role.
They balance that interest by providing pictures at intervals, allowing privacy for the family for the rest of the time.