Why didn't Johnny mind dying?Besides the fact that he was content seeing the parents thank him and the children being alive, of course.
In Johnny's letter that he leaves inside of the novel Gone with the Wind for Ponyboy to read, he mentions that he has accepted his situation and doesn't mind dying because it was worth saving those kids from the burning church. Johnny then reminds Ponyboy to tell Dally that it was worth it and to look at a sunset sometime. Johnny also explains the meaning of Robert Frost's poem "Nothing Gold Can Stay." He then reminds Ponyboy to stay gold and tells Pony that there is still time for him to become the person he wants to be.
Other than the explicit reasons Johnny mentions in his letter, he may not mind dying because he believes that Ponyboy and Dally will benefit from his death. Johnny's words of wisdom to Ponyboy and Dally in his final letter indicate that he believes his death can be of some value to his friends. Johnny possibly feels that Pony and Dally will learn not to lose their innocence or forget that there are positive things in life. Johnny may also believe that Pony will share his story to benefit other teenagers in similar situations, which is exactly what he does.
I am wondering if there is something that makes you think Johnny has other reasons than the ones you mention. He does not actually explicitly give any other reasons why he does not mind dying in that letter that he puts in the book that he gives Pony.
If I had to try to come up with another reason, I would say that, just in general, he feels like his death might have some value. In addition to the things you mention, perhaps he feels like he is helping to save Pony. Maybe he thinks that his note to Pony, and the experience they've had together, will make Pony realize that he can really "stay gold."
In the end, of course, it does help Pony. Johnny doesn't know that, but maybe that's what he is thinking as he writes that last letter.
Johnny tells Pony that he doesn't mind dying because those children he saved from the burning church were worth it. He feels that they have a brighter and more potential-filled future than he does, and therefore, his sacrifice, in the end, is justified.
Johnny's home life was also wrought with despair, pain, and hatred. The other greasers even go so far as to tell him that he "ain't wanted at home either." Hinton tells us directly and indirectly that Johnny's home life is abusive and violent. Therefore, his departure from life will be a bittersweet end to a lot of misery that he has personally experienced.