In Minecraft, are the monsters that wake you up when you sleep in a bed in an unsafe location monsters that already exist and were moved from a dark location, or are they monsters which are spawned given that the game found a path from a dark location?
They are newly spawned monsters that can find a path from a location that supports them spawning.
There is some great research on this by bugi74:
I've got a Bukkit plugin that manages sleeping with AFK players that caused me to look in to all this myself.
It is a new mob that spawns to punish you for having a dumb bed location. Easy test;
1) Switch mode to peaceful, this clears out all the monsters
2) Switch back to normal and sleep in an unsafe bed
3) Monster spawns immediately
We can see that this monster is freshly spawned, because time doesn't actually elapse while your sleeping (but instead, the game just sets the time of day to morning), so a mob couldn't have "spawned" followed by "teleported to you". We can witness this lack of time-lapse by noticing that furnaces don't smelt while you're sleeping, for example (this might have been fixed in a recent patch? but I don't think so).
From the Minecraft wiki:
So it appears that it's not a spawning issue, it's an issue of "can the mob physically get to the 'unsafe to sleep' position from where it spawns".