Their bioluminescence could be defensive. They themselves developed a countermeasure for blocking the light emitted from luminescent prey they ingest.
It seems that emitting light when eaten is a final defense to attract the attention of your consumer's predators to protect others members of your species from a similar fate.