Dear Pojo
If your Defending Pokémon is confused , you attach a defender and then
get tails for flipping to attack; does confusion damage still happen?

Thanks

No - Defender will prevent up to the first 20 damage done from an attack per turn.  Confusion is the Pokemon attacking itself, so defender will prevent it.

Scott