Still, why were the Prophets suddenly aware of the idea that Bajor might be destroyed just then?
Again, the problem is that you keep using words that are rooted in our concept of time. "Suddenly" is not a word that has any meaning when talking about timeless beings.
After all the time that passed, they are suddenly convinced just then that it could happen--
Because for them, no
time passed, and every moment in the entire history of the universe was "just then." You need to set aside the very concept of time passing, of things happening in any order or at any pace, in order to grasp how the Prophets think or how causality works for them. Just think of how one event causes another. Ignore our perception of their relative order or separation. Just think of the progression of cause to effect without bringing time into consideration at all.
Additionally, even if
the Prophets had a linear existence, which they don't, there is absolutely nothing in the dialog to suggest they just "suddenly" found out anything. Nothing
suggests they "just found out."
Two things were at play here -- Sisko had a responsibility as a Starfleet officer to do what he could to stop the Dominion reinforcements, and if that meant sacrificing himself, so be it. The Prophets couldn't allow that, though and had plans for The Sisko, and him sacrificing himself was simply not an option.
Far from being a Deus Ex Machina, the Prophets had no choice
but to intervene. One can call that "writing into a corner," but IMO they would be wrong, because I see this as an evolution of his character going all the way back to the episode Emissary
. They wrote Sisko
and The Prophets
into a corner, on purpose. This ending was about Sisko truly being the Emissary and making the Prophets put up or shut up with regard to Bajor, and to just see it as a DEM, IMO, misses the whole point of Sisko's arc.