You shouldn't use "literally" for emphasis. You literally shouldn't use literally for emphasis.
Of course, most dictionaries say it's a thing that can happen now. For instance:
1 : in a literal sense or manner
2 : in effect [. . .] used in an exaggerated way to emphasize a statement or description that is not literally true or possible
(Merriam-Webster)
That second definition fits what you're trying to do with that eleventh-hour bit. But in practice, that second definition really means "figuratively"
a : expressing one thing in terms normally denoting another with which it may be regarded as analogous
(Merriam-Webster)
. . . which is really what you're trying to do with your eleventh-hour. "Eleventh-hour" is analogous to "the point when time is about to run out". It is "in effect" that point in time. But not "literally" that point in time.
Since "figuratively" is (literally!) an antonym of "literally", it rubs a lot of folks the wrong way when you use one when you mean the other.
If it were up to me, I'd just cut the "literally" part altogether. And then maybe switch up the words a little bit for readability.
The endleofan gathering was called as an act of last resort when something threatened the very existence of humanity.
. . . or perhaps:
As an act of last resort, the endleofan gathering was called when something threatened the very existence of humanity.
. . . or whatever. It all depends upon what idea you want to emphasize the most in the sentence. In any event, the main bullet point here is that I think "an act of last resort" conveys the idea well enough by itself.