Because it wasn’t actually caused by WhatsApp. It was Android malware that targeted a bunch of apps on your phone including WhatsApp and basically injected ads into them. It was called the “Agent Smith” malware for a while if you remember that.
I’m all for being aware of the historical safety concerns of big tech, but this article suspiciously leaves out information.