One major difference between Annesburg and Johannesburg is that Annesburg is a coal town, though. There were quite a few "company towns" built around mining and other industries in the US back in the early 20th century. The Red Dead Wiki (the other one, I mean) cites Buxton as one possible basis. I think the similarity in names is just a coincidence, because it doesn't really make a lot of sense for Rockstar to base a town in their representation of the 1890s American south on a city in South Africa.
And just a point of fact, all the locations in RDR2 likely have some real world basis, such as Saint Denis being based on New Orleans and Marko Dragic's lab on Wardenclyffe Tower.