South Africa in Barnes' day weren't a substandard side, the way they had been in the 19th-century, and the way Bangladesh have always been, and the way Zimbabwe have been of late.
There has only exceptionally rarely been sides so obviously below the required standard in Test history than there are at the current time, and never two at once. This, inevitably, means that Test averages in recent times look different to what they should for those who've played said sides, and more than ever for those who've played them a lot and done stupendously well against them.
Sangakkara is far from the only beneficiary, obviously. A few others are Stuart MacGill, Mohammad Yousuf and Jacques Kallis. Anyone whose average is pulled significantly off its true Test-class-team course by the addition of substandard sides should be talked about equally, and this applies equally throughout history. Thing is, though, as I've said many times - the only other time in the 20th-century where this has happened is New Zealand in the 1930s and 1950s, and they hardly played any cricket by the standards of the current time, so the effect is much smaller.