(What I settled for was violating the Prime Directive - I couldn't help myself - and putting a ladybird on said plant in the vicinity of the aphids. The immediate consternation and aggression among the ants was terrifying when seen from the perspective of something less than half a centimetre in size.)
The word for this sort of thing is, apparently, mutualism, or a mutualistic relationship - an "ecological interaction between two or more species in which both species benefit". The ants get nectar from the aphids; the aphids get protected from ladybirds. There are plenty more examples, many of which seeming to involve ants (my favourite being the Devil's Garden phenomenon).
I am not sure whether human-animal farming relationships can be classed as a form of mutualism - it depends if you see the farm animals as benefiting or not. Possibly in classically pastoral relationships the case is easier to make than modern industrial farming, but that's an argument for another day. But there's clearly a similarity between the ant/aphid dynamic and that of, say, humans and goats.
Or, humans and pigeons. This is a photo of the remains of the "living larder" at Speke Hall, a restored Tudor manor house which I also recently visited. It was once used to store pigeons, who were bred for their tasty flesh in Tudor times; the birds were obviously kept in the stone box things on the back wall.
What kind of mutualistic and/or farming relationships would exist in a D&D campaign setting taken to its sensible conclusions? Most obviously and boringly, giants would presumably herd giant animals. There are plenty of other relationships that suggest themselves. I wonder if there isn't a more interesting way of doing it: count the number of monster entries in the Monstrous Manual, randomly generate numbers so you can pick two of them, and see if you can think of a mutualistic relationship between the resulting entries. For example, I've just performed the exercise three times and come up with:
Firedrake and Insect Swarm. A species of firedrake that follows swarms of locusts as they travel across the land, feeding off the weakened and starving beasts and people left in their wake. The locusts benefit by the firedrake occasionally searing off old vegetation with its breath so they can get at the lush green shoots underneath.
Owlbear and Peryton. Owlbears often live near peryton nests, scavenging the corpses of the people whose hearts have been removed by the perytons during mating. The owlbears protect the nests in "return" (though of course neither party is conscious of this).
Giant Rat and Sprite. Sprites tell giant rats where to find birds' nests to steal eggs; sometimes - though not often enough for the rats to cotton on - they lead them instead to the homes of enemy sprite clans to cause mayhem.
Clearly, this won't work for every pairing (rust monster and giant squid, anyone?) but juxtaposition can produce excellent results. Do your own. For those working with the 2nd edition Monstrous Manual, I reckoned there were 304 entries (though I may have miscounted). Random.org does the rest.