“There is literally nothing that can be done to prevent this type of thing when you are dealing with that many people in such close quarters.”
You can reduce the frequency and number of people infected. Keeping the ship clean and improving the materials used in common areas are two steps.
Those ships are kept very clean. There are crewmembers walking around 24/7 wiping handrails, etc. You can’t monitor every passenger for illness and be sure they aren’t infecting others. You just can’t. People have to be responsible for their own observance of good hygiene. Unfortunately, some just don’t get it.