I've had this idea for an Ability before as a signature Ability for the Slowpoke family. They need a turn to realize that they got hit the previous turn lol. I never bothered to make it though because it's just one of those things that are really complicated implement. My advice would be to simplify the Ability's effects. For instance, just have the Ability trigger on direct damage taken. Keeping track of effects, statuses, indirect damage, etc. will be a huge undertaking.
But if the Ability just triggers when the user is hit, then you can *probably* just copy something like Disguise to negate damage taken, but save the damage that WOULD have been taken to an effect, along with the current turncount as an array, like [PBEffects::DelayedDamage] = [damage, turncount]. And then at the end of each turn, there's a check to see if any Pokemon on the field have your Ability, as well as if [PBEffects::DelayedDamage] isn't empty, and if it isn't it matches the saved [turncount] with the current turncount. If the current turncount is higher (aka, a turn has passed), then it applies the saved [damage] to the Pokemon.
I'm totally spit balling here though, it's probably not that easy.