The reason why cantrips are bad against discard attacks is that you want to discard your bad cards and keep your good cards. If your hand is full of mediocre cards (e.g. cantrips or Silvers), then you have to discard mediocre cards, which hurts you more than having to discard bad cards.
Engines are particularly good at dealing with discard attacks, because they can do powerful things with just a couple of good cards in the initial hand, and because they will redraw whatever cards they discarded anyway, so you don't even mind having to discard good cards to discard attacks. For that reason, it's much less harmful for an engine to have Pearl Divers in it than it is for, say, big money (even if it's not terminal draw/BM which obviously doesn't want PDs regardless of attacks), and you can safely buy them, even to the extent that you lose your ability to cherry pick your bad cards to discard — as long as you don't buy them to the extent that you lose your ability to keep your good cards in your hand, but you hardly ever get that many chances to choose between PD and nothing anyway.
Having your example hand hit by a discard attack is pretty bad, that's true. But the cantrip isn't the sole reason for it: you also have two Silvers and an Estate that are equally responsible for you not having any good cards in your hand that you can keep. In fact, the situation would be much worse if the Great Hall was another Silver, because then there would be no way you could have a good turn (unless you're fine with just a single $6 buy). And it would be much, much better if both Silvers were Pearl Divers instead (you even have control over what to set aside for NV that way!).