As a filly living in Canterlot Castle, Twilight Sparkle either wakes up from a scary nightmare, as well as missing her family, or a thunderstorm, Princess Celestia comforts her. Just because she was her mentor didn't mean she couldn't offer a motherly touch.