I may of worked out why. It could be because illager captains can spawn in raids. When you kill one in the raid, the bad omen instantly applies to the village, stacking with the current raid. You do not see the bad omen effect as you are in the village when it happens. This makes raids infinite.
I had the same problem. Optimizing and clearing cached data fixed it until I left the chunk.
I think this is the same for other single player worlds.
(To recreate, do the same as above, except instead of a realm use a single player world)