What is going on in the Law, where the Israelites are told to bury their waste? I've heard that God's main intention was to protect his people from sickness. Am I on track?

Yes, more or less. More is going on there than simply health advice.

Leviticus 15 is one passage that indicates that uncleanness -- something invisible -- can be spread through careless contact. Did you know that germ theory became part of commonplace medical knowledge only in the second half of the 19th century, despite the fact that the Bible clearly supported it? In the 18th century, the Italian scientist Spallanzani had suggested that unseen, microscopic germs could carry disease, but his doctrine was rejected. It was not until the time of Louis Pasteur, who painstaking proved that invisible germs were real, that the reality -- and danger -- of germs were accepted by the scientific community. (Interestingly, one aging French scientist, irate that Pasteur should advocate such a preposterous theory, actually challenged him to a duel!) This is important because germs kill. Infection causes disease and death. Perhaps that's one reason the Bible demands the proper disposal of human waste products (Deuteronomy 23).

In the Middle Ages (as today often in the Third World), human feces were thrown into the street. The rats were thrilled, but men and women suffered. Certainly this unhygienic practice was a major reason that the Bubonic Plague spread so rapidly in ancient times. In communities following Torah, such tragic epidemics might be avoided completely.

The health benefit of following the Torah is, I think, only incidental. The main point is not to be separated from disease, but from diseased culture / practices / ideas. That is, to be separate from the Canaanites (while Israel was in their land) and from Babylon (during the exile). In the Torah, the Lord wants us to distinguish clean and unclean (also a theme in Ezekiel). That's the only way we will remain his holy people!