In the case of treatments, chemo or immunotherapy may make the vaccine less effective. Hormone therapy probably makes you less susceptible to COVID infection, but has no lasting effect if you come off it and Testosterone returns.
I don't think prostate cancer itself ever compromises your immune system, except perhaps in very late stages.
I don't think a lot of thought goes into selecting the recipients of these notices - they probably just selected everyone currently being treated for any cancer.