Near the end, Aramaki made a deal with the Prime Minister to "sacrifice" Section 9 in exchange for the Ministry of Justice taking action against the Party Secretary-General. What I don't understand is why Section 9 had to be "sacrificed." The Prime Minister didn't want to disturb the Lower House elections, and the Ministry of Justice wanted credit for the prosecution, but all of this could have been achieved if Section 9 simply continued lying low and handed over their evidence and credit to the Ministry of Justice. What advantage was there in trying to eliminate Section 9?
In episode 24 it is heavily implied that Section 9 (not the members) is formed by the Prime Minister himself and Section 9 (i.e Aramaki) only reports to or takes order from either the Home Minister Affairs or directly from the Prime Minister himself. This is why Aramaki is immediately called in by the Home Affairs Minister to meet at the Prime Ministers residence in episode 24 when the leak happens to discuss the situation.
The other thing to realize is that, Section 9 got on to the suspicion regarding Yakushima involvement pretty late. Yakushima and his cabal were most definitely keeping tabs on Section 9 from very early on, seeing as to how quickly the Section 9 secret operation (carried out in episode 23) gets leaked to the media just before Section 9 tries to make a move on Yakushima.
So if you take these things into consideration it makes sense as to why Aramaki went to the Prime Minister and why Section 9 ended up being disbanded. It's basically because Section 9 were not able to verify Yakushima involvement in the case until almost the end. As a result, Section 9 didn't have enough time or window to keep tab on Yakushima himself. Therefore they were unable to prevent or predict the leak. Thereby also catching them by surprise. If they were able to verify Yakushima's involvement early on and kept tabs on him, there most likely would not have been the disbanding of Section 9. Or the at the very least the situation would have gone differently.