How much damage is dealt/taken when that damage also reduces a creature to 0 hit points?

The particular case where this question came up was when a Hobgoblin Warlord attacked my ally, who had 7 hit points remaining. The attack’s damage was rolled for a total of 13, meaning they would fall unconscious. However, I am a Redemption Paladin which means I can Rebuke the Violent:

[…] Immediately after an attacker within 30 feet of you deals damage with an attack against a creature other than you, you can use your reaction to force the attacker to make a Wisdom saving throw. On a failed save, the attacker takes radiant damage equal to the damage it just dealt. […]

The question that arose was how to calculate "the damage it just dealt". Did the Hobgoblin Warlord deal 7 or 13 damage to my ally?

The only thing I found that somewhat answered this was the section on "Instant Death" which includes the following (emphasis mine):

[…] For example, a cleric with a maximum of 12 hit points currently has 6 hit points. If she takes 18 damage from an attack, she is reduced to 0 hit points, but 12 damage remains. Because the remaining damage equals her hit point maximum, the cleric dies.

This seems to state that the Cleric still takes 18 damage, even if her points drop to 0, but then it also states that 12 damage "remains". It’s not what I would call definitive and it doesn’t explicitly state that that is how damage works so I’m wondering if there’s anything that makes this even clearer.