This usually happens to me once or twice a night. A simple solution is to make sure you fight mobs away from their spawn point, this helps reduce or eliminate the possibility of them respawning on top of you and killing you.
Another annoying problem with this is when your walking past a group of mobs that are grey, and then they respawn green and instantly aggro. Doesn't usually mean death since they are green, but it is quite annoying.
If this is intended then they certainly need to fix it so that they won't respawn if they are "locked". Also, if it is intended, I would like to know the reason why, because it seems nothing more than a annoyance to me.