Vaccines against coronavirus have been in development for decades. The urgency for them really ticked up with in the early 2000's with SARS coronavirus floating around. Also the tech for quickly developing mRNA vaccines has been in the works since the 80's.
HIV is a very different virus and we do have pretty good treatments to prevent infection (prep) and stop HIV from becoming AIDS. I have someone in my family that has had HIV for decades and he is going to die from old age, not AIDS.
Cancer, like a broken leg, is not a virus. It's an entirely different medical problem.
Also significant parts of mRNA vaccine research were built on HIV research! Fighting HIV/AIDS directly led to the technologies that let us make the Covid vaccine possible. We really do "stand on the shoulders of giants" - we build new knowledge based off the work of those who came before us!
I guess you could say the same thing about hepatitis vaccines.
HPV and hepatitis are not cancer, but they can increase the risk of certain cancers. Often times the best way to beat cancer is to limit exposure to the things that can increase the risk of getting it.