In my own headcannon (that's most likely wrong but plausible nonetheless), the Undertaker had a partner that he fell in love with but accidentally killed in the midst of battle. Haunted by this, he opted to retire from the Shinigami Dispatch. In order to do this, he had to be a teacher for five years or something. Even while he was a shinigami, before he retired, he was an undertaker, and he buried the person he loved in remembrance.
His mind may have always been rather fuzzy, and perhaps that's why he killed her (in my headcannon). Don't blame me for overactive imagination, though! ^^'