Respect for the deceased is expressed by the rituals surrounding the disposal of the body, not by the disposal of the body per se. Cultural practices for disposing of human remains vary widely, but practical considerations are a significant part of it.
There are a lot of unpleasant details to disposing of human remains that morticians perform behind the scenes. (The television series Six Feet Under is a good fictional account of the work of morticians.)
With modern ships, we cut them up and scrap them, a process which is not given any sort of reverence for the ship being scrapped.
Particularly for naval vessels, there are formal decommissioning ceremonies that occur along with the removal of weapons and materials from the ships being removed from service. So there are often expressions of reverence for the ship, as it is scrapped.
The concept of recycling human bodies is not so unfamiliar to us, either. The first successful heart transplant was in 1967; fifty years later, organ donation is widely (but not universally) culturally accepted and considered compatible with respectful treatment of the deceased. 619
Part of the ritual of burial is symbolically returning the body to the Earth -- a sort of recycling.
So, I would suggest that there would be a formal ritual for disposing of the "body" of an AI, and that ritual would be wrapped around the material process of disposing of that body, as symbolic gestures that the material process does not mean a loss of respect for the deceased AI.
What those material processes would be would depend a great deal on the relative wealth and technological capabilities of the society. One in which it was easy to construct a starship, and which would scarcely miss the resources, might have a final ceremony as the starship is sent on course to be vaporized in a star. One with more limited resources might, following a ceremony methodically dissassemble the ship or structure, retaining major components in their current form, or reducing them to their simplest useful form, melting down metal and so forth.
Incorporating parts of a deceased AI's body into a new AI's body might be a ritual in itself. Think of it like the display of a saint's relics.
Another possibility is that there could be some ritual in which the deceased AI's body is repaired, and decorated and modified to indicate it has a new identity, as the body of a new AI. Think of this as something like reforging a sword, like the reforging of <PERSON> into <PERSON> in The Lord of the Rings. 159