I don't know if it was written and hacked together at the last minute; Mass Effect was originally planned to be a trilogy from the beginning. I feel like the ending was planned from the beginning, they just ran out of time. I think EA might have put extra pressure on BioWare to get this title out on time.
You are unfortunately wrong. If you've read this thread you know that I've spoken at length with members of the Mass Effect 1, 2 and 3 writing team about the ME3 ending. Additionally, there's extensive behind-the-scenes material available from the same guy who did the behind-the-scenes doc for Portal 2. This ending was not planned from the beginning (a fact confirmed both by ME3 behind the scenes material, my own interviews, and members of the ME1 writing staff), and in fact the lead writers were struggling to come up with an ending until the very last months of ME3 development. They had to delay recording with Martin Sheen because they didn't even have his dialogue written.
After months of struggle, lead writer Mac Walters - after a night of drinking - scrawled out the outline of the ending on a piece of notebook paper with the infamous conclusion LOTS OF SPECULATION FOR EVERYBODY, and it was then hastily developed by the lead writer and the lead developer without input from the rest of the writing team (for example, the guys responsible for the superlative Tuchanka level.) This is why much of the Mass Effect 3 writing staff quietly dislikes the ending and and why we're getting an Extended Cut to try to fix it.
The original ending for the series planned during Mass Effect 2 development, by the original lead writer Drew Karpyshyn, involved dark energy and a plot very similar to that one TNG episode where warp drive turns out to be damaging space-time. It was ditched after he left, but you can still see the foreshadowing set up in ME2 with the Haestrom subplot.
Patrick Weekes told me that they're going to try to work these loose plot threads from the old ending into the Extended Cut so it all ties together better. I personally think that ending is just as bad, so I'm glad they didn't go with it.