Without knowing precisely what was going through the minds of the members of Monty Python when they wrote this skit, I would speculate that the launching of a cow is a silly modern reference to the relatively common usage of biological warfare in sieges.
You can find an article (warning PDF) by Bunner et al which details several documented cases of the usage of biological agents in warfare, even before the exact mechanism of transmission was known. The relevant passage is:
The use of biological agents was not limited to defensive or retrograde operations. Scythian archers in 400 BC and Hannibal in 190 BC were probably the first to "weaponize" biological agents. The former did it by dipping their arrowheads in feces or decaying cadavers; the latter, by launching pottery filled with poisonous snakes onto the ships of King Eumenes during the Second Macedonian War.1-3 Plague-infected cadavers were hurled into the fortifications of adversaries during medieval battles and during the famous Mongol siege of the Ukrainian city of Kaffa (now Feodosiya) in 1347.1-5 Later, the development of the trebuchet, an enhanced catapult, made it possible to accurately launch several-hundred-pound loads of manure or large piles of bodies that previously had been too heavy.8
While modern authors do question how effective such grisly missiles were in the transmission of disease (ibid), they were definitely thought to be effective by the defenders of a siege. Furthermore, such rotting flesh would definitely lead to disease transmission if the corpse made its way into the water supply or well.
So, for the Monty Python sketch, maybe the joke is actually on the viewer. The launching of the cow would have been viewed with horror and fear during the Medieval period which is being lampooned in the movie. The fact that it could be considered a joke in modern times is more reflective of the audience's knowledge itself.
In the directors and cast commentary for the 40th anniversary edition DVD of the film Monty Python And The Holy Grail, some members of Monty Python do offer some explanations why a cow was launched over the walls. There are two separate DVD commentaries, one featuring Eric Idle, John Cleese, and Michael Palin (writers and performers), and one featuring Terry Jones (also the director) and Terry Gilliam (also the production designer).
In the Idle/Cleese/Palin commentary, Palin points out the lunacy of the knights' charge against the castle: "it was completely ineffectual, charging against a completely sheer stone wall, no way of getting up" - they clearly see the scene as showing that the English were udderly ridiculous. Idle then relates the 'battle' in the movie to historical events: "They also threw animals and everything over the wall, and turds and anything they could, at sieges".
In the Terrys commentary, Terry Gilliam delivers a long monologue justifying the throwing of a cow over the wall during a siege:
It's not an extraordinary idea, the Romans used to do it...they would fire animals into castles - diseased animals - to try to create infections. I remember at the battle of Carcassone, in the South of France, the town had been under siege for...a year or something. And to try to break the siege...to fool the besiegers, they took the last remaining pigs they had and stuffed them with the last remaining bits of grain, and they fired them out to the besiegers to show that they had plenty of food, that they could to fire this stuff. And I think actually the besiegers decided to give up and go home. So the idea of catapulting animals in and out of castles was not an invention. The kind of animals were an invention, I don't think cows were ever fired.
Of course, Gilliam soon also points out that the group were at a point where they simply found cows funny:
This obsession with animals was just something we were going through at the time, and once you get started on it, it never stops.
It's obviously no cowincidence that several Monty Python members have at least a passing knowledge of history, given that all of them had undergraduate degrees, and many in the humanities - Michael Palin majored in modern history, while others majored in history adjacent humanities degrees while at university (Gilliam majored in political science, Idle and Jones majored in English). However, while more than one member of the group makes claims in the DVD commentary about the truth of animals being used as objects of warfare - and neither of those members (Idle, Gilliam) is the one famous for history documentaries (Jones) - it's worth remembering that the people talking in the DVD commentary may have had 40 years of history graduates telling them about battles a bit like that one. After all, Monty Python And The Holy Grail is a comedy film - it may also be that they just thought that some cow-catapulting would be really funny. I mean, Idle laughs at the French saying 'fetch-ay la vache' 40 years later in the commentaries; it's not inconceivabull that the idea of the cow-tossing just really put the writing room in a really good moo-d, and so they decided to milk it for all it was worth.