And if you prevent someone from getting sick via preventable care you prevent them from spreading that sickness to others. Additionally even non-communicable diseases often have large impacts on those related to the person with the disease, so I don't see how you can truly separate the logic.
For comparison, compare laws against punching other people to laws against punching yourself.