How long can bubonic plague,small pox,cholera survive in the corpse of it's victims?

I recently visited a Quarantine station on Sydney Harbour which is no longer in service. It opened in 1824 and is the final resting place to over 500 migrants mainly from Europe and Asiatic nations. When ships were suspected of carrying disease
the ships were set alight and the crew and passengers were quarantined until they either died or were cleared of any infection. During the early years of the Q Station the diseased
bodies were buried in shallow graves which at times became exposed, but the site of the graveyard was at an elevated location on the foreshores of the harbour, when it rained the water drained through the graves and into a stream which was used only metres downstream for drinking, cooking and cleaning and thus infected others.

I assume that diseases require a living or recently living host, is this the case?

Plague

How long can plague bacteria exist in the environment?
Yersinia pestis is easily destroyed by sunlight and drying. Even so, when released into air, the bacterium will survive for up to one hour, depending on conditions.
What is cholera?

Cholera
How does a person get cholera?

A person may get cholera by drinking water or eating food contaminated with the cholera bacterium. In an epidemic, the source of the contamination is usually the feces of an infected person. The disease can spread rapidly in areas with inadequate treatment of sewage and drinking water.

The cholera bacterium may also live in the environment in brackish rivers and coastal waters. Shellfish eaten raw have been a source of cholera, and a few persons in the United States have contracted cholera after eating raw or undercooked shellfish from the Gulf of Mexico. The disease is not likely to spread directly from one person to another; therefore, casual contact with an infected person is not a risk for becoming ill.

Smallpox
If smallpox is released in aerosol form, how long does the virus survive?
The smallpox virus is fragile. In laboratory experiments, 90% of aerosolized smallpox virus dies within 24 hours; in the presence of ultraviolet (UV) light, this percentage would be even greater. If an aerosol release of smallpox occurs, 90% of virus matter will be inactivated or dissipated in about 24 hours.
So, to summarize all that, there should be no risk from contact with any corpse more than a day old. The plague can last for up to an hour, cholera doesn’t spread from person to person, except through fecal contact, and aerosolized smallpox dies within 24 hours. I assume that non-weaponized smallpox wouldn’t last as long or be as contagious. The same site states that extensive face-to-face contact would be needed to spread the disease.

Note: all info is from the CDC.

However, note that the OP specified that the corpses were buried in shallow graves and in a spot that drained into the river which was used for drinking water and so forth. It wasn’t so much a question about literal contact with the corpse as it was also what runoff through the graveyard into the drinking water might produce. I suppose there is a chance then that cholera might have survived and been spread via this method.

True, I forgot about that. So, I agree that cholera could have contaminated the drinking water.

Plague is transmitted by flea bites and inhalation of material exhaled by persons or animals with the plague. Since fleas flee the dead and corpses don’t cough, I wouldn’t worry much about getting the plague from a dead person buried in a shallow grave.