Removing a body from the track shouldn't take long, of course. The problem is if you need to do detailed forensics because it might have been a murder. At least, I am guessing that's the reason that sometimes a line stays closed for a long time with a lot of police vehicles parked in the vicinity (here in England), whereas on other occasions there is a death but only a few trains are delayed and for only 10-30 minutes.
Interestingly, I have on at least one occasion heard about trains being held up because of a dead body on the track that wasn't hit by a train. That definitely sounds suspicious. But of course no further information is given to the general public. (Body placed by criminals but reported before it was hit or the train happened to be slow enough to stop in time? Or suicidal person drugs themselves before placing themselves on the track?)
> not really something anybody can do much about
Good video surveillance might help eliminate the need for a detailed investigation of the (perhaps) crime scene. But, yes, not an easy problem.