How to recreate:
Have a health scoreboard, /scoreboard objectives add health health
Give yourself a item with negative MaxHealth, /replaceitem entity @s armor.head minecraft:leather_helmet{AttributeModifiers:[{AttrbuteName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-2,Operation:0,UUIDLeast:137757,UUIDMost:964305,Slot:"head"}}{{}]} 1
{{}}{{}}You see that the health score dosn't go down or updates even when you regenrate or having some absorption
When you clear the helmet the health goes back to your original health
Linked issues
duplicates 1
Attachments
Comments 3

But it should damage the player cause if it don't damage the player he is able to have more hearts than the maxHealth attribute is allowing to have.
The maxHealth attribute only changes the amount of HP you are able to regenerate to. So when you set that to something lower than your current HP, the game will not remove anything as this isn't what the maxHealth attribute does.
Damaging the player by 2 HP will in this case resolve the issue and the player would not regenerate to anything above 18 HP.