More information here: https://www.missouribotanicalgarden.org/gardens-gardening/your-garden/help-for-the-home-gardener/advice-tips-resources/pests-and-problems/insects/mealybugs/insect-pests-of-cacti-and-succulents.aspx
The plant may have been weakened for two possible reasons. One being a poor genetic constitution and the other may be insufficient lighting. I suspect the latter may have contributed, since you have put your cactus on the windowsill. Is this plant variegated or did it become paler after the onset of infestation?
Unfortunately, Opuntias (and the Opuntioid family in general) are susceptible to pests. One reason being
Opuntioids also lack fiber caps to their phloem bundles, which in other cacti protect against sucking insects and stiffen developing internodes.
From my experience with Opuntias, they normally grow well, but once an infestation begins it speeds-up and is hard to get rid of. I had the same problem with Opuntia Vestita, which grew outside. Possibly the hairy O. Vestita needed more direct sunlight hours that what I could offer?
Saving this plant means administering systemic insecticides and rubbing alcohol until it can grow new healthy shoots and no longer needs clean-up. Preventive measures may be growing them in full sun or intense grow-light. A better alternative would be to grow a new plant, not before cleaning up the area.