Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
In some salmon, etc., the behavior is 'semelparity' ("the characteristic of usually mating only once in a lifetime"), or 'suicidal reproduction'. Moths are a different kettle of fish, although some moths are semelparous as well as being inadvertently suicidal by being attracted to light.
IIRC the moths are simply using a naive algorithm -- they are trying to navigate by starlight, which depends on the light source being very far away, so that the moth's angle to the light source effectively never changes. There are other insects, however, that practice autothysis -- deliberately exploding themselves, usually to protect their fellows. Dunno if that's considered malaptive or not, but it does lead to their demise :)
From the title I would've tried to toss out species-ending. But that's precisely what the salmon is preventing, and with the poor moths it's just pilot error. - You're trying to find other animals that are literally like moths to a flame? ... fatal attraction didn't help me look. Also, lemmings don't commit suicide.
I found that magnets are dangerous for dogs. Not quite at the level of moths and flames, true, but the way I found it was with dangerous attraction animal behavior.
dangerous attraction animal behavior
.