He didn't have spotter planes or satellites to tell him what was behind the ridge, ya know. It actually wasn't a frontal attack, but a point attack.
Tactical intelligence on both sides was not a long suit in the Civil War, Lee really did not have a handle on just how much shit was stacked up in the reserve staging area and artillery park in the large bowl formed by the two ridges behind the focus of his attack. If he'd realized the force and logistic disparity he was facing, and gone in anyway, well maybe then you could mock him but he didn't. The Army of the Potomac outnumbered the Army of Northern Virginia by roughly 2:1, and with a massive supply and ordnance superiority and South had the burden of the initiative and the North all the advantages of the defense, the amazing thing is that Lee was able to disengage successfully without being totally destroyed. Meade got the blame and Lincoln fired him over it, but in a mobile pursuit he would have lost all his advantages and he would have been at some disadvantages of his own as Lee fell back onto his supply base and gained strength, and Meade had no better intelligence than Lee, so it was not as foolish a decision as 20th Century armchair Napoleons seem to think.