Tolkien Theory Time
I posit that in the Palantir one of the many possible futures Sauron caused Lord Denethor to see was a future that when both his sons had died there was no hope for Gondor. That this was somehow a sign of things he had seen. Losing Boromir was the first crack but so long as Faramir lived there was a glimmer that maybe Gondor would somehow survive and that there was a purpose in continuing to strive against the Dark Tower then when Faramir returns near enough to death to be mistaken for dead the last tiny thread of Denethor's hope and sanity snaps and with his city nearly in ruins he's like 'yep this is definitely the doomed future I saw in the Palantir one there's no purpose in living any longer when all is lost' and decides to turn himself and his son into a human smore party.
















