Baron Harkonnen, while watching the attack, notes that his weapons are old-style kinetic artillery, not the modern energy-based ones, and thus bypass the shields. Elsewhere Harkonnen claims that subverting Yueh was nothing more than habit.
But the baron rarely tells the whole truth. He broke Yueh's imperial conditioning because he found a way to do so. The fact that it had never been done before, that allegedly it couldn't be done, made it a challenge. Unshakable integrity, to the baron, is like a vacuum--it shouldn't exist. Yueh became just another Harkonnen asset, all the more useful because he was above reproach.
Was Yueh's interference critical? There's no way to be sure. Leto might have died in the attack. On the other hand, without being able to count on Yueh, Harkonnen might order his troops to advance more carefully, regardless of the cost to themselves, and take Leto alive. No doubt the baron had other contingencies in place. Of course, if Leto and House Atreides had survived the attack, the rest of the story would have turned out differently.
For literary purposes, however, Yueh is all the more tragic because his betrayal means nothing. His wife is already dead. Deactivating the shields doesn't change the outcome. To the baron he is nothing but a loose end, a tool that has outlived its usefulness, fittingly stabbed in the back.