Pensions are typically not paid based on average teacher salary, but paid based on terminal teacher salary. Defined benefit pensions are quite different from a 401k.
In our district, once you qualify for a pension you get 2% of your terminal salary per year you work. If you work for 40 years, you will be paid 80% of your last year's salary.