Applying a generic.armor attribute when worn on the body for a horse armor doesn't provide any protection to the horse. This worked on 1.20.4.
To reproduce:
1. Add the following loot table to a datapack in your world.
{ "pools": [ { "rolls": 1, "entries": [ { "type": "item", "name": "leather_horse_armor", "functions": [ { "function": "minecraft:set_attributes", "modifiers": [ { "attribute": "minecraft:generic.armor", "name": "", "amount": 20, "operation": "add_value", "slot": "chest" } ] } ] } ] } ]}
2. Give it to yourself via /loot give @s loot <namespace:loottable>
3. Equip it to your horse. Check the max HP it has.
4. Hit it with a diamond pickaxe.
5. Chack its max HP again. It will have decreased by 5HP points, omitting all and any protection.
Please attach a datapack which helps to reproduce this issue