The solution to this seems pretty straightforward: force social media companies to choose to identify as a "platform" or a "publisher", rather than a mix of the two that gets to claim the most convenient aspects of both.
If they choose "platform", then they can take no responsibility for content posted, but also allow all content, and only remove content when it is required of them by the legal system (when the content is illegal and has been reported as such)
If they choose "publisher" then they are free to censor, "deplatform", delete, or restrict posting of anything they wish, but if someone posts something illegal, they take their share of legal responsibility for publishing it.
If they choose "platform", then they can take no responsibility for content posted, but also allow all content, and only remove content when it is required of them by the legal system (when the content is illegal and has been reported as such)
If they choose "publisher" then they are free to censor, "deplatform", delete, or restrict posting of anything they wish, but if someone posts something illegal, they take their share of legal responsibility for publishing it.