Australia was 180 for five in its second innings at the close, a slender lead of 41 runs with five wickets remaining.
De Villiers said he actually believes that he still needs to prove that he belongs in the Test team.
Spinner Maharaj claimed the key scalp of Steve Smith, Australia's captain caught behind off an outside edge for 11 as his side slumped to 86-4. He was the anchor in late partnerships of 44 with Quinton de Kock, 84 with Vernon Philander (36) and 58 off just 43 balls with Keshav Maharaj (30).
The son of a surgeon and a lawyer, he did not learn his craft by bowling hand me down two piece balls in the dusty streets of a rural village (as some ill-informed commentators have mentioned) but in one of the best private schools in all of South Africa.
However, the action was overshadowed by events away from the pitch, including Cricket South Africa issuing an apology to Cricket Australia after an incident involving two of their employees being photographed with fans wearing Sonny Bill Williams masks in an apparent attempt to embarrass David Warner.
Two of Australia's most criticised cricketers stepped up when a fired-up Rabada had the ball reverse-swinging and a day three finish was a distinct possibility.
Jeff Crowe of the Emirates Elite Panel of ICC Match Referees said: "I found that there was contact between Rabada and Smith, and in my judgement the contact by Rabada was inappropriate, and deliberate".
But the day belonged entirely to the South Africans and De Villiers, in particular, who felt the home team had to hit back hard after the debacle in Durban last week.More news: Trump Trade War - Australia spared
In fact, the only reason Australia are still breathing is due to the elegance of Khawaja and doggedness of Mitchell Marsh.
Australia's fast bowlers, who had a heavy workload on the previous day, wilted under an assault in which De Villiers played strokes that were sometimes breathtaking. Maharaj looked set to walk off, with de Villiers clearly frustrated by his shot selection, but replays showed Khawaja had failed to let go of the ball before his foot was grounded over the rope, and it was ruled a six.
Khawaja played and missed early and survived a probing spell from Ngidi before surprisingly flourishing against the spin of Maharaj.
"He's got to be smarter and he knows that", Proteas veteran AB de Villiers said.
Khawaja's knock of 75 came off 136 balls and included 14 boundaries.
Cummins was the pick of the bowlers with three wickets, while Hazlewood and Mitchell Marsh snapped up two wickets apiece.
The Proteas pace sensation was on fire in the first innings after his five-wicket burst within the space of just 18 deliveries decimated Australia's batting order after they had got off to a strong start. In the match, Australia won by 118 runs and so, they are now leading the series by 1 - 0 game.
Second Test St George's Park, Port Elizabeth, March 9-13.