I don't think you understand the difference between value judgements of ethics and morality or the fleetingness of history.

Sex work is considered immoral under certain currently dominant religious doctrines. Mind you, even Christianity originally carved out a niche for sex work (Jesus certainly was more kind to those earning their living with sex work than to those earning it by exploiting the poor). Arguably this hangup in the modern day largely stems from Christianity and Islam however, which means it started less than 2000 years.

But morality doesn't tell you much because it literally comes down to religious doctrine, which only works for practitioners of the given faith and can still change over time depending on which interpretation of scripture is taken as canonical (e.g. few Christians getting in a huff over strip clubs would feel equally offended by mixed fabrics). This is why I didn't say "moral people" or "immoral things" but "good people" and "bad things".

Good and bad are value judgments that can be entirely arbitrary, i.e. what I might consider a good person is someone you might consider a bad person. This in turn can be based on a coherent system of ethics you follow or even something entirely inconsistent like most ethical systems that try to incorporate morality even when it conflicts with personal intuitive beliefs (this often leads to feelings of shame and guilt).

Ethics contrary to morality are usually defined in terms of harm and benefit. These terms are again subjective because they hinge on core beliefs, e.g. I think the goal should be for all people to have the ability to live a fulfilling life and not worry about having their basic needs met so my understanding of harm and benefit is defined in terms of whether something contributes to or detracts from that. Many people share core beliefs that are similar enough to be compatible with mine, so our shared system of ethics is "intersubjective" rather than subjective (i.e. entirely up to the individual) or "objective" (i.e. a universal truth claim about the universe).

So is sex work "good" under my system of ethics? No? Yes? Not really? Sex in itself is not inherently harmful so that doesn't make it bad. Transactional exchanges are not ideal but sex work is hardly unique in that. Arguably sex work is exploitative because most sex workers would prefer doing other work if they had the opportunity and weren't suffering from external pressures (often financial ones) but some sex workers genuinely enjoy their work as long as they know they can perform it in a safe environment. But that again isn't inherent in sex work itself but follows from the power/wealth imbalances and exploitation of the kyriarchy (i.e. sexism, capitalism, etc). So an instance of sex work may be bad but the act of performing sex work itself isn't necessarily even when the act of consuming sex work might be.

But speaking of missing the point, remember what I actually said: most people don't like it when bad things happen to good people even if they like it when bad things happen to bad people. "Bad things" in this case refers to circumstances that negatively affect the individual's ability in the above sense. "Bad people" referring to people whose actions negatively affect (everyone) else's ability in that sense.

Personally I think it's best for bad things not to happen to anyone if we can avoid it because enjoying the suffering of others is in itself detrimental to achieving said goals. But some level of schadenfreude seems to be a universal part of the human experience, so I still stand by what I said.

Of course things get messy when your ethics have to account for fairly intricate moral codes with tons of rules that boil down to being justified with "because God says so": good luck trying to incorporate "also you shouldn't wear mixed fabrics" into an ethical system you can apply day-to-day other than as yet another one-off you have to memorize because it doesn't affect anything in any meaningful way. I suppose that might be why almost everyone eventually started ignoring it. The question then only remains where you draw the line when it comes to just-so elements of your ethical system inherited from doctrinal morality: is makeup bad? Tattoos? Anal sex?

Or, of course, you can argue that the goal of your ethical system is to maintain The Natural Order. Except then you have to decide what that is supposed to be and why it puts you near the top rather than near the bottom (because these natural orders usually tend to form neat pyramid shapes for some reason). At which point it's usually easier to go back to religion because then at least someone has already written scripture you can point to.