It wasn't the first time Lee made that mistake. It was the last though.

The reason why Lee attacked was of course
1) He was the one on offensive, and has been unwilling to disengage since day 1 because he has won the prilimaries and
2) He has yet to taste a significant defeat (especially tactically) so was overconfident
3) He had attacked on both flanks and failed. He naturally assumed then that the enemy force was reinforced on both flanks, and would be weak in the center, estimating the amount of troops he is targetting would be no more than 5000. That is true as of the end of day 2, but Meade guessed correctly Lee's intentions.
4) Elements of Anderson's division broke through the Union center on day 2 and made it as far as the top of cemetary ridge, so Lee thought it was doable.

Rather than blaming the battle on Lee (who does need to be blamed), I blame most of the battle on Stuart's abensence (which Lee allowed).