Email is sort-of a walled garden: I've heard running your own email server is very difficult and many providers will consider your mail as spam.

Technically it's impossible to make a service that can't be a walled garden, specifically because the walls can be legal. Today, there are laws preventing you from sharing data you have access to (e.g. DMCA, clickwrap). Without those laws, no publicly-accessible data would be walled off, because people could just scrape and redistribute it, and distribute hacks (though without those laws, less services would exist in the first place, since they would be much harder to monetize).

> I've heard running your own email server is very difficult and many providers will consider your mail as spam.

This is just another case of monopoly abuse though. Both Google and Microsoft (the two largest email providers) make it notoriously hard to deliver regular mail to their customers. Meanwhile, you still get tons of spam that makes it through their filters so they are both blocking legit mail and allowing spam to filter through at the same time.

Yes but it is more as a result of the weakness of the protocols. It started naively as something to send message from machine to machine. There was no real concept of an identity or a user, it only has a random name (and later domain, but that part is tied to DNS and another machine abstraction). And there is the problem that sending is "free".

Which is why spam is an impossible problem to solve. The newer messaging apps are successful because they start with what really matters in the first place: who is sending the message, in other words the identity. Sending is in theory free, but in practice you pay with your data by letting the companies running the service exploit it for ads. Since they have full control of the identities of everyone using the service, a misbehaver is quickly blocked/removed depending on faults.