That most likely won't happen in the Fediverse, unless every developer agrees on some common protocol. But it is possible. See the Nostr protocol and DIDs.
I tend to think of Matrix more like WhatsApp instead of Discord. The features of Discord really just aren't available in Matrix. Which is why I recommend Revolt (or something like it) instead of Matrix when people ask for alternatives to Discord. It does not look or function the same. Yeah, there are some stuff in common, but not enough to be called similar. It feels like comparing Mastodon with Lemmy.
Well yeah. Revolt is not really E2EE (yet), so it doesn't matter. And it is not impossible to build a private messaging app with ActivityPub, see sup from the dev of Pixelfed. It also seems like some people are trying to get E2EE encrypted DMs in Fediverse to be a thing: https://wedistribute.org/2024/05/encrypted-dms-activitypub/
Oh no like I meant using ActivityPub to federate between different Revolt instances or even other future software that might be an alternative to Discord and is federated using ActivityPub.
In the FAQ, they state that federation is not in their roadmap, but if someone can do it, then they are willing to merge it. Since Revolt is written in Rust, we can use Lemmy devs' activitypub federation crate. I might take a look at it someday.
That most likely won't happen in the Fediverse, unless every developer agrees on some common protocol. But it is possible. See the Nostr protocol and DIDs.