That is only possible because Ejabberd doesn't use the AGPL license.
Nothing in the AGPL prevents either from occurring.
No idea whether the assumption is true that Whatsapp is just a branded deployment.
As the countless messaging apps out there demonstrate, the value of communication apps lies in the network they build. If they provide a decent UX, and successfully bootstrap a network large enough, it wont matter if their code is open.