At the link it says that the bacteria, P. luminescens is found in parasitic worms that get into insect larvae and proceed to disgorge the bacteria, whereupon the bacteria kills the larvae.
What purpose is served by killing the host? Asking for a friend.
https://www.promegaconnections.com/angels-glow-bioluminescence-uncovered-on-the-battlefield/
Details at this link.
And then there’s the insect larvae we call maggots, that are supposed to help heal wounds.
https://www.chelwest.nhs.uk/your-visit/patient-leaflets/tissue-viability/maggot-therapy