Even if you don’t consider STDs to be an actual judgment for sexual immorality, they are a consequence of such behavior and part of God’s prohibition from such things can be to protect us from what He knew the consequences would be.
The same thing can be said of when God told Adam and Eve that if they ate the fruit, they would die and many people took that as God’s punishment for the sin, but God could just as easily been warning them of what would happen if they ate. It comes across entirely differently between angrily pronouncing judgment, and giving a warning out of loving concern. It casts God in a whole different light.
Good point, but there are many scriptures where we know God judged man with serious illnesses. Leprosy being one, and other infectious maladies as a direct punishment fir their sin