Forego Pension for Index Fund?

I currently work for a public-benefit corp in NYC so I have access to the NYCERS pension system. If I join, I would become part of Tier 6 aka 63/5 meaning I would have to work for five years to become vested and can start receiving payouts at 63. The payout calculation = (1.67% * # yrs of service * avg of highest 3 earning years).

I am in my mid 20s and I have been working here for a little over 4 years and project myself staying a total of 8 years. I’m going to assume my final average salary will be around 90k. My total buyback amount for the 4 years I already worked will be around 20k and the sum of contributions over the next four years will be around 22k. My projected benefit when I did the math will be around 11-12k annually.

All my life I heard people talk about how pensions are the best thing ever and that you should definitely enroll if given the chance. However when I do the math, it looks like I’d be way better off just sticking the buyback and contribution amounts in an index fund and riding it out.

Would it be dumb to forego the pension and just invest it all in an index fund instead?