I think the issue with either incest or necrophelia is they are circumstances where the mechanisms of sexual attraction are broken or malfunctioning.
In the case of Incest – biologically we have systems that drive attraction based of genetic and physically similarity. Obviously the most genetically and physically similar people you know are your closest relatives, so we have a similar biological mechanism that blocks that attraction if you grow up in a family relationship with someone. Those are things that are biologically innate rather than culturally normal or legally dicated-such as taboos about facility, monogamy, polygamy, age of consent and so on
There are ways that this block can fail to happen (the best demonstrator is when related people separated at birth meet again unknowingly – they often fall head over heals in love). But if you have an otherwise normal family unit and theres sexual attraction within it then something within one of those people is broken – if they act on it then to override the block (that the other person should have) they need to be coercive to abusive to do so.
This is different to the teacher – pupil issue, where both parties might genuinely have a loving attraction to one another but have a cultural / professional taboo or arbitrary legal threshold barring that relationship. A healthy adult in that situation would be able to keep a lid on those desires until a time or place when its more appropriate, a less healthy one would tell the pupil to pack a bag and run away to France. In that latter situation the attraction is quite natural but the failure to control impulses isn’t.
The situation with necrophilia similarly is that its part of a broken model – sex involves two people consenting – having sex with someone or something (animals, the vulnerable, children, corpses, a trafficked prostitute, a Range Rover) that can’t consent or reciprocate is about exercising power over them not sharing something with them. Its not the cold flesh or the palour that turns a necrophiliac on its the powerlessness of the other party. You could argue that the deceased has given consent for their body to be used in that way but thats irrelevant because its still and unconsenting act the necrophiliac is being driven by.