While playing hardcore, I found a pillager patrol and while fighting them, the captain was killed by an other pillager attempting to fire at me. I got no bad omen from this.
I assume this is because it wasn't me who fully killed it, even though I still was trying to attack them.
Correct, the Bad Omen effect is not applied if the player did not kill the Pillager Captain, this is intended