The difference lies in that it's a very rare campaign where PC's are either soldiers OR lawmen. Typically, they are neither and are certainly not lawfully empowered to enforce anything. Additionally, they are not constrained by legal systems in place to make sure that they don't overstep their authority.
I've seen this comparison a number of times when this topic comes up and it really seems more apples and oranges to me.
So, your characters never enter the homes of monsters? You only ever kill in self defense? Really?
Going into an ancient dungeon and finding items is called grave robbing and it's generally punishable in all sorts of unpleasant ways. Looting the dead SOLDIERS was a form of payment, true. But going into a tomb and robbing it was always seen as evil.
And, again, PC's aren't soldiers. The comparison isn't really valid.
You are speaking in absolutes here in most of the games I play in the party is usually not a bunch of people who met in a tavern and go out adventuring for the sake of adventuring. They belong to churches, kingdoms, guilds and often armies.
And there have always been laws of course they can choose to ignore the laws just like people do in real life.
It is really up to the DM to put these kind of laws in place. I always do and so do the other DMs I play with on a regular basis.
When I talk about monsters I am talking about creatures like slimes, undead like skeletons and zombies you get the drift here. And why shouldn't you explore their homes since their homes are usually in the wilds are abandon ruins. Are you saying that it is wrong to go on safari because you are entering wild dangerous animals homes? Yes my characters have entered the homes of monsters and yes my character has killed them in self defense. I have also trapped them so we didn't have to kill them, left them alone and ran away from them.
We have even gone in and killed a group of evil mindflayers in the sewers of the city but they were kidnapping people and breaking the city law and we had a warrant from the king.
I will have to let my cousin know that she is a grave robber and can expect the law at her door anytime. Since she has an archeologist has gone into pyramids, the tar pits in England and other ancient burial sites.
And yes this is a debate that has been going on in archeology circles for a long time of when is it proper to disturb ancient burial grounds. Some say never others say once there is no one left to care.
People have been grave robbing since time began. And it depends on each culture on how they look at it. Some cultures find desecrating the body at all as something evil other believe that eating your fallen enemy was a sign of respect. In modern day some Jews believe that an autopsy or taking organs for transplant is a sin. And it goes without saying that a lot of people don't.
You can do the same for your DnD worlds decide what is acceptable and what is not.
Just like you can decide what part if any alignment plays in your world.