Sorry for your loss, it's never easy to lose a friend.
So, for those unaware, canine distemper is a particularly virulent disease closely related to measles with about a 50% mortality rate amongst dogs. There are a number of reasons that a vet may tell you that you cannot bring home your dog for burial:
Natural route of infection is airborne, droplets, and infected surfaces.
Burying your dog in your yard may expose local wildlife, causing additional spread that could come back to domesticated dogs.
There is a zoonotic potential for humans. As I mentioned, the virus is closely related to measles and there is some evidence that it can transmit to humans or trigger complications for us. Most of us are protected by measles vaccination, in any event, but the very young are not, so that too is a risk to consider.
All in all, I have to admit that the vet has a legitimate concern, much as it may have added some distress for you. He may also be prevented from releasing the dog by law, this is not necessarily unusual when dealing with more dangerous illnesses in animals.