Ashton Agar became only the second Australian to take a T20 international hat-trick as his side beat South Africa by 107 runs in Johannesburg.