Thanks for these. I've noticed something quite odd in your battle log - several of the moves used in this battle claim their target to be a pokemon which is not currently fighting. I've spent some time attempting to reproduce this issue, but so far only found one way which has been working reliably for me, although somewhat different to what you're doing. I have described my process to reproduce below:
Spawn in a trainer NPC using the NPC editor, give them a level 1 pokemon. Turn 1, poison the target. Then just continually switch until they die from poison damage. Make sure they can use their last move successfully (i.e - you're not immune to the attack or something), but also that none of your pokemon faint in this process. Worth noting that I only switched in my lickilicky on the last turn, yet all of the moves claim Lickylicky as the target. Battle log: https://pastebin.com/nRYvvefz
Of course, this is not the only issue present here, especially given I could only get this to happen reliably against a trainer and not wild pokemon. I would encourage you to share more logs if this has continued to happen, and if possible try to find patterns or ways to reproduce the issue.
I will pass the one reproduction method I found to internal, but further detail would still be appreciated to track down the true source of the issue. Thanks!