The next GOP speaker must navigate the same pitfalls that doomed McCarthy, as the challenges of a narrow majority and stalled Ukraine aid await their leadership