From my time majoring in Arch, I'd say the rule of thumb is:
"Is the culture the body came from vanished or changed to the point where no one has a personal stake in it."
So for example, vikings are long since gone. Modern northern europeans are generally a completely different culture, therefore not grave robbing. Same with Ancient Egypt, Ancient Rome, etc...
Indigenous tribes in North America and Australia for example, still very much around and still very much grave robbing (though that opinion is controversial)
Basically, if the existing culture still shows reverence to those ancestors...leave them alone. If the existing culture no longer honours them as ancestors, dig baby dig.
Even if there was something to learn I don't want anyone digging up my grandma. If someone's descendants are saying "Don't do that to our ancestor's grave, it's disrespectful in our culture" then you're defiling a grave.
That would usually be done before digging. Only after learning all you can through deep soil scans and confirming structural integrity so as to not have it break upon moving it. Then you may dig it up.
I feel like it should be simpler: did the culture the body came from have good enough records in other ways that we would be unlikely to learn anything by digging up the body that we couldn't learn by studying other records? Then leave it alone.
If they failed to keep good enough records, and knowledge would be gained by the study, then study away.
I don't follow archeology directly, but every couple months I listen to the Unearthed! episodes of Stuff You Missed in History class, which goes over the prior quarter's archeological news. A whole section is dedicated to reciprocations, because there are tons of complaints. UK museums still refusing to send back stuff stolen from other lands, items found to have been illegally taken, etc.
So it's more if nobody the people who run the place cares about complains.
Law enforcement often employs archaeologists for that very purpose. My professor in Uni for example would go help them out whenever they got a call about a body being found because there just weren't enough murders in my part of the world to justify having someone full time.
The skill-sets are virtually identical, the bones are just fresher. Reading a crime scene and reading a archaeological site are basically kissing cousins.
At the core it's about social contract, and despite all of it's flaws i think that even the countries in the imperial core have pretty ethical policies around (most) human remains, this is one of the least controversial areas of policy
Unfortunately the change is pretty recent, and all the grave robberies were grandfathered in, so don't ask for your indigenous grandfather's remains, it was before the legislation
Well, a court ordered exhumanitions of a murder victim is not grave robbing, so your example in the 2nd paragraph just makes the point that there are in fact more categories than "grave robbing" and "archeology".
And yeah, governments often definite who owns what (since in natural terms, plenty of things such as land cannot be possessed) and hence directly or indirectly what is robbery.
(Which brings the interesting question of "who owns the grave" so that taking from it is robbery).
I think it's more about intent and what you do with the findings and who gains from it. If you and your team announce your plans ahead of time, document everything meticulously, deliver the pieces to a museum or archive, publish papers and deliver seminars and attend conferences on it... it's probably archaeology. The public then has at least some access to the value of your work.
If you and your associates do it all in secret, sell the artifacts to some rich asshole (esp. via a fence), and cover your tracks, that seems a lot more like grave robbing. You've stolen all the value in that case.