"I would have thought that the underlying reason a police force may be dangerous to a prostitute is the same reason why pimps and punters can be dangerous to prostitutes. Neither respect the human rights of prostitutes to have full agency of their own body, the right to consent, the right to withdraw consent, the right to be safe from violence etc.They are viewed as inferior."
This is what I mean. However, you are wrong in thinking decriminalizing doesn't help. As I explained above, many sex workers are legally "pimps", because they rent and sub-rent their rooms to other sex workers, and help each other finding customers. As long as this is per se defined as pimping, sex workers are criminalized. The thing is that even if people don't want to see sex work as work, it functions like any other business. People rely on other people, they outsource certain tasks and specialize in other ones. Legislators shouldn't try to isolate sex workers from services they might need. We need laws that punish exploitative arrangements (which certainly exist), but many third-party-contacts make live so much easier and safer for us, for example the possiblility to rent rooms, be it from a fellow sex worker or a third person. I have worked as an escort as well as in an appartment with other women that was cared for by a non-sex worker. The latter was much safer, and the conditions absolutely fair. A good escort agency is a blessing for a single sex worker who doesn't know anyone she can trust with her job. One simple but very effective safety measure is: Always have someone who knows where you are, and let the client know this. If you are with an escort agency, the client knows that you are not alone, that you will be searched for if anything happens. By the way, this is a similar measure that some taxi drivers and social workers have. Also, an agency manager can give valuable advice for unexperienced escorts, especially on how to properly set lines.
"Would corrupt police officers still not abuse their power if prostitution were legal?"
The problem is that in countries like England and Sweden, "cracking down" on sex workers and robbing them is a job requirement for policemen. They have to do it. The corrupt ones see an opportunity and may abuse this situation to gain sexual favors in exchange for not carrying out their duty. But it's the whole system that even enables this kind of abuse (and supports the "legitimate" kind of abuse).
How police personnell treat sex workers has a lot to do with what kind of training they have. If a police officer learns that he should respect a sex worker who seeks help, he will be more likely to do it. For example: In Sweden, there was a mother who sought help against her violent husband from the police. She was also a sex worker. The swedish authorities said she needed to sort her "real" problem, sex work, out first before she would get any protection against her husband. They believed she suffered a "false conciousness" and lied about her husband. In the end, he was even awarded custody of the children. He killed the woman and a social worker. This is only possible in a climate where police are taught that prostitution is the worst fate a woman can suffer, and all other abuses don't matter compared to it. On the other hand, in England in a certain region (i don't remember where) the police have been actively encouraged to be respectful with sex workers and treat crimes against them as hate crimes. This has proved effective: Sex workers trust the police and report crimes, and as a consequence of higher crime-solving rates, the violence has decreased.
In a social climate where sex work is legally defined as violence against women, the stigmatization is practically impossible to overcome. If you say buying sex is buying a woman, people will start to believe it and clients may think they can actually buy you, and outstanders believe you let yourself be bought and don't respect you. A change in attitudes doesn't happen overnight, but it goes hand in hand with legal acceptance of sex work and ACTUAL protection for sex workers.