The reason is that they allow users to customize the software through code. When you create a Discord or Minecraft server, they act as a "platform" for your server, you can write code to customize every aspect of it. I think that counts a lot.
I don't know any alternative that is as customizable and good as Discord, and I don't think Discord will be replaced any soon while a platform that supports that level of customization comes up.