I don’t know if “historical excavation” is a thing but what I mean is when it becomes official where a university or museum gets involved.
I would be very interested to see an answer relevant to European cultures which developed the in-depth forensic methods we've all read about. But I'd also like to point out that the answer to this question is not universal.
A particularly interesting example is the Ancient One, also known as the Kennewick Man, who is one of the oldest human bodies ever found in north America, around 8,500 years old. His remains were discovered accidentally by a couple of kids, not deliberately excavated, but the ethical issues you ask about were hotly debated for 20 years. I will try to summarize below, but this article gives a decent accounting of the issues: https://www.historylink.org/File/21141
Many Native American tribes do not believe their ancestors' graves should be disturbed, and unfortunately there is a sad history of disrespect for their wishes. The Native American Graves Protection and Repatriation Act attempts to protect Tribal archeological sites, and the local tribes believed the remains of the Ancient One should be returned according to the NAGPRA.
A contingent of scientists claimed that the remains could not be related to modern local tribes, for various reasons with some scientific backing and a lot of speculation about the events of prehistory. DNA evidence finally showed that the Ancient One was related to the Colville tribe, but the analysis required the tribes to compromise their ethical opposition to using destructive analytical methods (ie, grinding up some tissue).
The Ancient One was finally repatriated and reburied with ceremony. https://www.nwnewsnetwork.org/post/northwest-tribes-know-exactly-how-they-want-return-ancient-one-earth