Are you asking why you don't keep reputation for content that is no longer visible (e.g., answers to questions where the question itself has been deleted)? I think the answer to that should be obvious: reputation is given in recognition for useful contributions. If no one can see it, did you make a useful contribution to the site? No.
If the issue is that someone deleted a suitable question with useful answers, then that's a different story. Flag the question for moderator attention, make that point, and request that it be undeleted. Some users who don't understand how a Q&A site works (specifically, that we are building a reference library of high-quality answers to programming questions) think that it's OK to delete their question after they've received an answer. It isn't, and moderators will happily reverse that incorrect action. But please don't abuse this by flagging low-quality content for undeletion. There's naturally some subjectivity here, so let your conscience be your guide, but recognize that we don't want to shoot ourselves in the foot by undeleting stuff that was incorrectly deleted (procedurally speaking) but isn't actually worth having visible (functionally speaking).
If you're struggling with the fact that you keep answering low-quality questions that ultimately get closed and deleted, which is causing you to lose any reputation you've gained, well, this is what we call an educational moment. :-) Stop doing that; spend your time and effort on higher-quality questions that deserve the attention. If you recognize a question as the type that will probably be closed and deleted, flag it for the appropriate reason instead of answering it. Similarly, if a question seems simple, it is very likely a duplicate (considering Stack Overflow has been answering programming questions for 10+ years now), so you'd be better served by going to find the existing canonical Q&A on that subject and flagging the new one as a duplicate, rather than posting a new answer.