Fun fact: Apparently, cats do this sort of thing because they're very light sleepers.
Cats sleep on average 12-16 hours per day, but all in very light naps, throughout the day. The only time a cat goes into a deep sleep is when they're injured or sick, and need the extra rest to recuperate.
So when a human who they see as part of their pack goes into a deep sleep, it makes them really worried, and they yell to make sure you're okay.