Why don't 後で and 前に both use the same particle (I suppose I would think に would be more appropriate). They both seem to be the same kind of statement, just with different times (before/after), so I really can't think of any reason for the particle discrepancy.
Cross-linguistically, grammatical words like に and で are often unpredictable or idiosyncratic, and you can't always explain them logically.
For example, in English, we say arrive at but not *arrive to. And we say Welcome to X but not *Welcome at X. Why? No reason. It's arbitrary. It seems like the alternatives should be just as logical, but for some reason we only say them a certain way. And sometimes these requirements vary over time, or from place to place. For example, American English speakers say on the weekend, but British speakers say at the weekend. Unfortunately, language learners have to memorize these facts and move on.
So what about 前に and あとで?
Here's what Martin writes in A Reference Grammar of Japanese (1975), p.219, as part of his multi-page explanation of に versus で:
So the reason is unclear, at least to Martin. We can still try to guess, though! Etymologically で is a contraction of にて (and you can still hear にて occasionally in very formal registers), so perhaps we might speculate that the difference is related to て suggesting temporal order ("after").
But I personally think you're better off just memorizing 前に and あとで and not trying to find the logic behind them—it's possible there's no logic to find!