Hi Bridget,
I'm not 100% sure how cancer treatment would affect HRT, but several cancers do have a hormonal component which could potentially be helped with transgender HRT. Indeed, one of the primary 'on-label' uses for cyproterone acetate is in fact to treat prostate cancer; its use as an antiandrogen for MtF spectrum people (though very common) is really completely "unofficial" as far as the pharmaceutical companies are concerned!
As for whether it would be worth transitioning if you knew you didn't have much time left... I've spent the last 8 years building up the courage to transition, scared how others would react, what if it is a mistake... the usual doubts, fears, what-ifs. Any time in that 8 years, it is quite possible that I could have lost my life in an accident, or suddenly passed away, and not even my close friends would have really got to know the real me. Yet had I been diagnosed with a terminal illness, I've positive the very next sentence to my friends and family after "I'm sick..." would have been "I've decided to transition". I'm finally doing it now, so better late than never, but thinking about this really brings it home for me. Life's too short; we really do need to make the most of every minute.