Because laws are not about justice. If you get something stolen you need to go to a judge to get a sentence that gives it back to you. You cannot take justice on your hands and expect to not be punished.
I don't think that is entirely true. For example, if a cheating happens in an online game you don't wait a court decision to ban the player - taking the justice on your hands and expect to not be punished. Or killing a person is illegal but you can use your self-defence rights if the other person is trying to kill you. You can use interfaces from copyrighted language (Oracle v. Google) for fair use purposes without getting a court decision first.
If the thing that you are trying to do is legal by universal laws, international laws and national laws (in order). You don't really need to worry.
In that stealing example let's assume someone stole something and you "stole" it back. Good luck for the first stealer to initiate a court case - which probably the stealer will not initiate because he will lose it plus with the expenses for the court. No court case meaning no complains therefore no crime.
There are many old games that runs some kind DRM system that is using deprecated Operating System API's - some of them are undocumented and mostly operated in ring 0.
Just because you pirated a game that you own a copy, in order to play it on newer version of operating system does not make you criminal. You may need a court decision only if you are not able to private or fix it without the company help but that's all.
This is infeasible though as evidenced by how actual theft doesn't get handled by the legal system (police, prosecutors, and judges). Realistically the only way to get your stuff back is to take it back yourself or somehow force the police into action by doing the work for them.