Australia is considering new data-privacy rules that could make it illegal for social-media companies to direct children to harmful content, the latest move by lawmakers around the world to address concerns about the impact of online platforms on young people’s mental health.