Jesus’s issues related to the use of the temple, not to the profession itself. More specifically, it was a condemnation of those trying to buy the release of their sins, not just those selling to them.
Jesus is quoting scripture here, “house of prayer” comes from Isa 56:7 while “den of thieves” comes from Jer 7:11. People in Christ’s time understood these references better than we do today. Here are the verses Jesus was referring to for the "thieves quote":
- Will ye steal, murder, and commit adultery, and swear falsely, and burn incense unto Baal, and walk after other gods whom ye know not; And come and stand before me in this house, which is called by my name, and say, We are delivered to do all these abominations? Is this house, which is called by my name, become a den of robbers in your eyes? Jer 7:9-11
Jeremiah’s admonition didn’t condemn those doing business but those who broke the law and came to the temple hoping to buy their forgiveness. In Jeremiah, the original “robbers” were those who broke the law and came to the temple.
On a more entertaining level, and to get into a little bit of the Greek, the word translated as “den” actually means a “cave” or “grotto” (spelaion, σπήλαιον). The word for “thieves” is (lestes, λῃστῶν) means “thief” and “pirate”. The phrase “den of thieves” comes closer to “pirate’s cave” since thieves are not usually associated with caves. For the original Greek explained, see this article.