Tensions rose as South Africa bowler Wiaan Mulder struck Pakistan's Babar Azam with the ball in the second Test at Cape Town.