The correct question is, why wasn't Stewart at Gettysburg from the outset? But the answer to both questions is the same five words: Uncle Bob screwed the pooch.
Because Stuart’s ego demanded he duplicate the ride around the Union army he did during the Peninsula campaign.
There were three possible routes for Stuart to follow into Pennsylvania. Lee gave Stuart the option to select his own route North. Stuart chose to move North into Pennsylvania by riding East of the Army of the Potomac. His miscalculation put him out of contact with Lee for eight days. While it was Stuart that chose the route, it was Lee that gave him the authority to do so. Your are correct in that Lee screwed the pooch with that decision.