A recent attempt at a dengue vaccine faced a similar problem. The most dangerous kind of dengue fever happens when you are infected a second time, by a different variant than you were infected the first time. It turns out that the vaccine ended up having a similar effect as catching dengue for the first time. People who never had dengue and got vaccinated had a lower chance of catching the disease in the future. But if they did catch it there was a higher risk of it being the more dangerous version. The end result is that the vaccine is now only recommended for people who already had dengue before.
This is specifically mentioned in the Radvac paper in the section titled "POSSIBLE MECHANISMS OF VACCINE-ENHANCED DISEASE,
VACCINE-INDUCED AUTOIMMUNITY, AND MITIGATION STRATEGIES"
https://en.wikipedia.org/wiki/Dengvaxia