As endings go, there are few sitcoms that ran as long as 'The Office' did that managed to get one as satisfying.
In fact, it could be argued that the final season was its poorest, the reason for it being the introduction of Brian, the Sound Guy, and that whole scenario with him and Pam. It's not that it was unrealistic, or that it disrupted the flow of the series, it just felt like it was coming close to jumping the shark.
At any rate, the scenario wasn't well-received by fans at the time, but what's even more surprising is that producers were prepared to follow it through to the end - namely, with Jim and Pam splitting up at the end. Not only that, but the whole thing also had John Krasinski's support.
In the book, 'The Office: The Untold Story of the Greatest Sitcom of the 2000s', Krasinski explained his reasons for supporting it. "My whole pitch to Greg (Daniels, the show's executive producers) was that we’ve done so much with Jim and Pam, and now, after marriage and kids, there was a bit of a lull there."
The idea was to have Jim and Pam split up about halfway through the season, and have them reunite in the reunion towards the end - but still remain split up. Of course, the idea never came to fruition and the book indicates that the idea wasn't "universally loved" by the writers, either.
Ultimately, the negative reaction to the storyline - even at the early stages of the season - was such that the writers quickly shifted gears and wrapped it up without having them split up. After all, that ending just wouldn't have been satisfying.