If we play the analogy further: life is suffering, apart from the brief ecstasy of eating sheep. The AI was trying not to suffer, thus chose the boulder.
Did my best to translate the (misguided) fitness function to fiction.
David Benatar reached a similar philosophic conclusion due to his utilitarian views, which was amusingly put (with a sort of AI present, no less) in this webcomic: https://existentialcomics.com/comic/253
Cutting one's losses early may appear to be the most rational act if trying to minimize an agent's total suffering.