See summary. It should be impossible for a player to get rid of a possible surprise raid just by drinking milk.
How to reproduce:
Give yourself milk
Perform "/effect give @s bad_omen"
Drink the milk
→ ❌ You no longer have a bad omen
This is probably unintended, because the developers wanted the player to keep their reputation among pillagers for killing their leader until he or she dies.
A possible way to fix this is to make bad omens player/mob attributes, rather than status effects.
Linked issues
is duplicated by
relates to
Comments

WAI? ...I guess pillagers are allergic to milk. 😛

It is something that should happen.
Consulted official MC wiki in English and Chinese:
English wiki
https://minecraft.gamepedia.com/Status_effect
All status effects can be removed by drinking milk, dying, being saved from death by a totem of undying, or traveling through the return portal in the End.
Chinese wiki
注释
不祥之兆在没有门或村民的村庄中无效。此效果可通过杀死多个灾厄村民队长叠加。不祥之兆的效果会一直持续到喝下牛奶或触发一次袭击为止。
Note
Bad omen has no effect in a village without doors or villagers. The superposition of this effect can take place by killing multiple illager captains. The bad omen lasts all along, until you drink milk or trigger a raid.
or traveling through the return portal in the End.
Losing effects after going through the exit portal is neither (proven) intended nor stated as intentional by the wiki (based on my knowledge). This is because the wiki states what will happen, not what should happen. The wiki has been known to state what happens in the game whether it is intentional or not, unlike official sources. See MC-6431
Also, I don't really care whether the omen should be cured by milk at this point. It doesn't affect gameplay in a noticeable way since you could just kill the illager leader indirectly, but I still think it is dumb to be able to cure it using milk, aside from extremely slight convenience.

I do not think that these effects should also be cleaned with milk, as they differ from all other effects. It is rather just signs. It seems to me strange that they can be removed with milk.
I just killed a naturally spawning patrol leader (took practically forever) and it gave the bad omen effect for a seemingly infinite amount of time. These permanent omens definitely should not be doused by drinking a cheap bucket of milk.