The first aftermath was agricultural: a later crop growing after an earlier mowing. Math is an old mowing word. The broader senses concern results and what follows an event.
The agricultural sense survives alongside the broader meanings; it was not completely replaced.
Source
Merriam-Webster: aftermathSense 1, Word History and Did you know? establish the crop meaning and distinguish the two math words.