I’m not sure “realistic” applies. It is a really bad idea, and a major violation of gun safety procedures, but that doesn’t stop some people from doing it.
You’re not supposed to store ammunition with a gun at all, and you’re never supposed to store one loaded. Obviously, keeping a loaded gun under your pillow breaks both those rules.
How likely a gun is to go off under the pillow would depend on the specific gun, and the specific condition it was left in. (Was it safed, is it chambered, ect.) As a general rule, most modern guns have safety mechanisms designed to prevent accidental discharges, but without a specific weapon, I couldn’t tell you if that applies.
(I think we were talking about getting shot while trying to execute a gun disarm, and that is very easy. Firearms are designed for ease of use, so the internal safety mechanisms I just mentioned don’t apply if someone’s actually holding it and ready to fire. Sorry about the confusion, there.)