It is indeed a parody of the "Mary had a little lamb"
rhyme, but I think it's meant to have a distinct nethack
flavour.
In nethack it is common to have to run away and leave your
pet, who will sometimes then be killed by whatever you ran
away from.
Therefore, "first to go" in this case means "first to go to
heaven", or in other words, it means the sheep will be
killed.
マザーグースの「メリーさんの羊(Mary had a
little lamb)」のパロディではないかと思われます。
なので、現在は訳が
"マリーは子羊を飼っていた.マリーがここで困っ
たとき,子羊がまっさきに来た",
となっておりますが、
"メリーさんの羊~ 羊~ 羊~ メリーさんの危
機に~ 飛んで来た~",
とした方が良いのではないかと思います。
#修正ファイル用意せず失礼