Leonard wanted him because Ali had him. Before Ali, Dundee wasn't being revered as an exceptional trainer.
But these fighters still had him and also had successful careers with him. Dundee wasn't only Leonard's trainer, he was also an advisor in many ways.
I wouldn't say that it's 'Margarito's style' that gives him an opportunity at the upset as much as it's his sheer size and power. Pac typically annihilates a fixed target, (or at least one that's right in front of him.)