Yeah, you get a morally optimal result from positing the supernatural setting in which prisoners' dilemmas are repeated potentially infinite times, a setting known in Christianity as Purgatory. Go figure.
"For cooperation to emerge between game-theoretic rational players, the number of rounds must be unknown to the players or infinite...As shown by Robert Aumann in a 1959 paper, rational players repeatedly interacting for indefinitely long games can sustain cooperation."
https://en.wikipedia.org/wiki/Prisoner%27s_dilemma#The_iterated_prisoner's_dilemma