Yes, this is not some home-brewed theory; there is actually science behind it. When you are asleep, most parts of your body are at rest, but your brain is busy working. The brain transforms short-term memory collected during the daytime into long-term memory, and it does that during the evening, when you are asleep. Therefore, your brain still needs its fuel, glucose. If you are in a state of hypoglycemia, the glucose level in your blood is low, so your brain cannot function efficiently, and sometimes, it would prompt you to wake up.
For this reason, don’t go for the foods that will peak the blood sugar level in a short time before sleep, you need something that will maintain the blood sugar at a constant level. The thumb of rule is: the more sweet, the higher and quicker the blood sugar level. So try something like buttered bread or eggs rather than fruits or chocolate bars.