There should be a law mandating government agencies to not limit their electronic communications to private third party platforms.

If they post something on Twitter, or worse, Facebook, they must also provide a copy of the post on their own website. Some kind of online government gazette, if you will.

https://en.wikipedia.org/wiki/Government_gazette

How would you define it so the internet wouldn't also be considered a third-party platform?

ISPs and infrastructure in the Internet are generally considered common carriers unlike social media platform who can do whatever they want. I don't understand why you think this would be hard to define at all.