Hooker's removal as AotP army commander may not have been exactly engineered by Lincoln, but the administration played its hand expertly in effecting that removal. After Lee begins his northward movement, Lincoln first quashes Hooker's plan for an offensive towards Richmond and demands that the AotP pursue and target the ANV while screening Washington. Hooker asks Halleck for permission to withdraw the untenable Harpers Ferry garrison and reinforce the AotP, but that request is turned down (also with Lincoln's connivance.) That refusal prompted Hooker's threat to resign his command, a threat that backfired on Hooker, as it gave the administration a pretext for relieving him, without actually doing so, by accepting his resignation. That being said, if Hooker had not fallen into that trap, I doubt if Lincoln would have traded horses that late in the game by relieving Hooker unilaterally. And if Hooker had remained in command of the AotP, the most probable outcome at Gettysburg would have been the same as it was under Meade.