Quinton de Kock and Temba Bavuma shared a 160-run stand to earn South Africa a first-innings lead over New Zealand in the second Test.