Yeah, people don’t consider the possibility of a AI naming itself Marvin deciding to end it all.
Chapter 11, Marvin says: "Here I am, brain the size of a planet and they ask me to take you down to the bridge". Also: "Further circuits amused themselves by analysing the molecular components of the door, and of the humanoids' brain cells". They are eastereggs for later events.
And Marvin says: "Let's build robots with genuine people personalities," they said. So they tried it out with me. I'm a personality prototype.
Although he was programmed to be depressed, he never gives up.