What happened:
I was playing on my survival world then I saw a pillager patrol. I used a Fire Aspect sword to hit it once, then let the Fire Aspect do its job. To my surprise, I got Bad omen, which was weird because it was the fire that finished it off, not me.
Further testing revealed that you will get Bad Omen if you punch the captain off a cliff, or if you hit it once, then it dies of natural causes. (This may be working as intended, but I remember using Fire Aspect to kill pillager captains before 1.16 and not getting Bad Omen.)
Death within a few seconds (3? 4? 5?) of player-inflicted damage will register as player-inflicted death.