They were lucky to win the two tosses in the first two Tests. It was the only series in history where every single wicket in every single innings fell - chasing totals in the fourth innings was almost impossible.
The outcome of the series was pretty much decided by the toss. Had South Africa won the toss for the third time in a row, they would have whitewashed India, and it would have been the most tightly-fought whitewash in living memory (apart from Pakistan vs England in UAE 2012).
Both teams bowled equally well, but Kohli was the standout batsman in the series. Overall, India were the better side in my view, and over the course of the last two Test series between the two teams, it has been obvious that India is better than South Africa.
They decimated them in their own conditions in 2015, but South Africa could not return the favor at home. They barely scraped through in conditions that were very much to their liking.