When teleporting a sleeping entity, it will awaken as a result of the resolution of MC-3715. However, the entity won't be teleported to the intended position. This issue occurs with both the TP command and ender pearls, which teleport mobs or players. They will only wake up, and to teleport them to the desired location, the command needs to be executed again.
Reproduction steps
/time set midnight/time set midnightPlace bed
Summon villager
/tp @e[type=minecraft:villager,limit=1,sort=nearest,distance=..10] ~ ~ ~/tp @e[type=minecraft:villager,limit=1,sort=nearest,distance=..10] ~ ~ ~Observation from the reproducer: The villager did not teleport to you; it merely awakened. To teleport it to you, the command needs to be executed again.
Expectation from the reproducer: The villager will arrive at your location with just one execution of the command.
Confirmed!