It's just a matter of reciprocity. Look for instance at Gambia: it's visa-free to go there for citizens of countries where Gambian citizen can go visa-free too.
this is just how countries managed/refused treaties with each others, based on mutual interests, history, etc
This is pedantic, I know, but also interesting (to me, at least): the country is actually The Gambia, not Gambia. They want the article! And yes, I cringe when I hear news announcers say "The Ukraine" too. :)
(They also have an unusually tasteful flag, that manages to represent the geography of the country without looking like a map.)
Many languages require articles for countries, with the weirdness that some countries are masculine (e.g., Mexico in French) while others are feminine (e.g., Argentina in Spanish).
I didn't know about the Gambia, but there are others in English, or example "The Czech Republic."
They can probably get a discount on The Ukraine's unwanted The's, as they only want to be called just 'Ukraine', but English speakers keep on prefixing with 'The'...
I doubt there's reciprocity involved many times. Better-off countries are going to have their citizens let in much more easily, in general. From a easier viewpoint: Who is more likely to overstay a visa/illegally immigrate? Apart from special deals (like the new Mexico-Canada one) that's probably a good way to guess at the visa status.
Although, after the visa issue, many less well-off countries are far more restrictive on immigration laws. Guatemala, for instance, charges a per-day fine for visa overstay and won't let you leave until it's resolved. My daughter, born to a GT national, owes around $4000 in fines on leaving.[1] Can you imagine how it'd be if Canada/EU/US would be viewed if they didn't let illegal immigrants leave until they paid fines?
Guatemala also supposedly requires a local transit-license to drive here. Whereas you can get stopped by the police as a Guatemala tourist in Canada/US just fine, here, even with passport and drivers' license, you can be detained/fined. However I imagine this is selectively enforced.
1: We'll end up either getting local citizenship to eliminate it, or somehow negotiating a better deal.
While you find reciprocity in many visa-agreements, it's not mandatory. If you look at the example from the parent comment:
Germans can enter Vietnam visa-free, while Vietnamese can't enter Germany visa-free. You find those one-sided visa-free agreements especially for many African countries.
It always comes down to negotiation power. To my knowledge, the (incoming) visa requirements should be identical for all countries of the Schengen zone though, as there is freedom of movement inside so having different entry requirements for each country wouldn't make much sense.
UPDATE:
Just did a quick check on this (as it's a curious question) and it seems to be the case:
You are right. I suppose there are many parameters, for instance countries trying to live from tourism are probably more likely to accept visa-free travellers from wealthy countries even without reciprocity.
this is just how countries managed/refused treaties with each others, based on mutual interests, history, etc