The fact that a gaze attack is used as an example of an effect that doesn't work specifically because it doesn't deal damage proves that it would work if it did deal damage. So, yes, it works on AoEs. You can also see the same definition of "attack" at work in the level 3 zealous surge ability, which lists spells as a type of attack, and in the level 13 mettle ability, which describes Will half and Fortitude partial effects as attacks. If you used the stricter version of the term, it would be a major nerf to the mettle ability, limiting it to just effects that have an attack roll and a save.
It's up to your DM to decide whether it works on self-inflicted or environmental damage, but it would make sense for it to do so.