Hey, I encountered a similar issue, every game:
0-1 upgrade: 1st shot = freeze and -2HP
2 upgrades: 1st shot = freeze and -4HP
3 upgrades: same as 2 upgrades but also lossing 1HP when shooting the front cannon.
It makes the game unplayable, especially as guardians sometimes shoot cannonballs as soon as their head get out of the water (while the game freezes) so it's unavoidable
My opinion about this is that the game seems to have a short freese everytime a new animation plays for the first time in a level/game, so when I shoot for the first time, the freeze actually makes the projectiles hit myself, so probably making the projectiles unable to hit me who solve the issue (I'm not sure if the freezing issue could be solved as well).
Another fix I guess would be to allow the player to augment HP much more times so that hitting myself would not be that much of an issue