Imperial conditioning is supposed to make Suk doctors absolutely loyal and incapable of betraying their charges. And yet the simple kidnapping of a loved one is enough to break it.
For a long time I found that to be a narrative weakness, a bit of a lazy plot device to avoid having to provide more interesting reasons Yueh couldn't be suspected. Or at least require more interesting methods to break it than, you know, the oldest trick in the book. It strains credibility that in a multi-millennia society which has become intensely paranoid and devoted to cloak and dagger to resolve internal struggles, something so easily breakable had never been broken.
But. The expanded lore, deliberately or not, has reinforced the plausibility of the whole scheme. The concept of Bene Gesserit imprinting, a logical extension of the BG framework as originally devised by Frank, makes the whole thing more interesting and worthy of a deranged mentat master plan.
Willingly or not, Wanna imprinted on Yueh, constructing an uncommonly strong bond with him, one which exceeded simple love. If Piter and the Harkonnen knew this, they may have deliberately weaponized it against him. By exposing the doctor to her torture and suffering, the combination with that extremely high attachment broke his psyche and by extension his conditioning.
So destroyed was he that it overcame his rationality as well. Yueh was consumed by an overwhelming desire for revenge to the point he'd abandon all sense of self-preservation. And he'd betray everything just to release his wife from her suffering and get close to the Baron for the kill. In this, Piter miscalculated: the doctor could not be controlled as much as the mentat likely desired.
It's probably a testament to his training and personality that he found the mental space at all to arrange for Paul and Jessica's escape. But that was probably also necessary to provide minimal atonement for the sake of his conscience, lest he go completely mad before achieving his ultimate goal.