Sometimes, after a mild lag spike, or after a playing for a long time, I will take a massive amount of damage, while under conditions where I shouldn't take damage. I have confirmed that this doesn't affect armor durability. One time I took 11 damage, one time 8 damage. I cannot be certain that this is not accumulated damage due to lag, but I have a good reason to believe that this is not the case, since when I do something that should damage me, I take the correct and full amount of damage immediately, and at the correct pace. I have had this problem on 1.21.4 Pre1 and 2 Hard Mode with the Villager Trade Rebalance, Minecart Improvements, and Redstone Experiments experimental features enabled.
Does MC-278518 describe your issue?