At the heart of the lawsuit is the allegation that social media companies engineered their platforms to keep young users online.