They did their focus, kill Orphan. It was only after that they actually got around to save Cocoon.

Being able to sacrifice your life for some temporary blaze of crazy magic power is not that uncommon an occurrence in FF titles. Out of everything in the ending I think that was the only part that made sense and was worth watching.