This is one reason why the current presidential succession law is so stupid. The Speaker of the House is in a different branch of the government. There should be no cross-over.
I liked the previous method where it went to the VP, and then to the various cabinet secretaries. And since those secretaries were all appointed by the President, there would (hopefully) be a continuity of policy.
If Trump leaves the VP does become , not the Pelosi.
That was changed because Harry Truman (who took office when Roosevelt died) wanted the next in line to be an elected official.
When he suggested the idea, he probably thought the White House and Congress would be controlled by the same party (as they usually were). By the time Congress changed the law, the Republicans had taken over.
Truman also wanted those below the president and vice president in the order of succession to face an election after becoming president, but that didn't happen.
I've always thought that having the Speaker of the House that high in the succession list was contrary to the separation of powers. At least the cabinet secretaries keep the process confined to the Executive Branch.