Fire Shield and Shield interaction

An awakened cat with wizard levels has fire shield active, and is melee attacked by a goblin within 5 feet of it. The goblin hits the cat but exceeds the cats AC by 4 or less.

Fire shield states:

In addition, whenever a creature within 5 feet of you hits you with a melee attack, the shield erupts in flame. The attacker takes 2d8 … damage..

Hooray! That pesky goblin will get their comeuppance. However, the cat does not feel like taking any damage from this attack, so it casts shield which has the following cast time and trigger:

1 reaction, which you take when you are hit by an attack or targeted by the magic missile spell

So the cat has clearly been hit by the attack, triggering fire shield and allowing it to take a reaction to cast shield as well. But shield has this effect:

… Until the start of your next turn, you have a +5 bonus to AC, including against the triggering attack,

Which would cause the attack to miss! Now we have Schroedinger’s fire shielded cat!

Does the damage from fire shield affect the attacking creature when you also cast shield to negate the attack? Or does negating the hit also negate the trigger which allowed shield to be cast at all?