If he had let Longstreet get his men between the US troops and Washington and made “those people” attack rather than head up hill.....
That would have been much better for Lee. I think best of all would have been to generally stand on the defensive on the Cashtown line where he could have protected several more days of foraging on the opponent's home ground.