You might want to look into how asymmetric public key encryption actually works.
Encryption isn't the problem, it's authentication.
Say Bob wants to talk to Alice through WhatsApp. They've never corresponded before. To encrypt a message to Alice, Bob needs Alice's public key. How does he get it? There are two options. Either he looks up Alice's public key on WhatsApp's server, or he sends a request to Alice through WhatsApp's server for her public key. In either case, he gets Alice's public key from WhatsApp.
Or, rather, he gets a key that WhatsApp tells him is Alice's public key. How does he know? That is, how does he authenticate the key? Alice has the same problem. She needs Bob's public key. However she gets it, how does she know it's Bob's?
WhatsApp can send its own public key to both Bob and Alice, then when Bob sends a message to Alice, encrypted with WhatsApp's public key (which Bob thinks is Alice's), WhatsApp can decrypt the message and re-encrypt it with Alice's public key, and forward the result on.
In practice, though, none of that matters because WhatsApp also writes the app. So they can just act as an honest broker of public keys and then have the app forward copies of everything to WhatsApp. I don't know if they're actually doing that, but it seems like that's what's being alleged.
BTW, my description above is for "public key encryption", but that's not what anyone actually does any more. What we use instead (and what Signal, and therefore WhatsApp, use) is "hybrid encryption". Specifically, ephemeral-key hybrid encryption. With that, Alice and Bob don't use public keys for encryption at all, and the public keys they advertise to the world are only used for creating digital signatures. Call these "identity keys", because they identify the user. When Bob wants to send Alice a message he generates an ephemeral key pair, signs the ephemeral public key with his identity key and sends it to Alice. Alice verifies the signature so she knows it came from Bob (because she got Bob's identity key from WhatsApp, so she's still fundamentally trusting WhatsApp). Then she generates her own ephemeral key pair, signs the public key, and uses her ephemeral private key with Bob's ephemeral public key to "encapsulate" one or more symmetric keys. Then she sends the signed public key and the encapsulated symmetric key(s) to Bob, who verifies the public key signature and uses Alice's ephemeral public key with his ephemeral private key to de-encapsulate the symmetric key(s). Then, Bob encrypts messages to Alice using a symmetric key and she does the same back. Public/private keys aren't used after the symmetric keys are set up. Oh, and both Alice and Bob discard their ephemeral key pairs and, per the Signal protocol, every time they use a symmetric key they derive a new one from it and discard the old one. All of this discarding of keys provides "forward secrecy", which means that if at any point in time Alice's phone is compromised and all of the keys extracted, the attacker can't decrypt any of the past messages.
Very nice security... unless WhatsApp is just caching a copy of all the message plaintext on their servers.