Because the Heretics already sided with the Reapers, and the Reapers provide them a path to True AI.
Soverign offered the Geth the technology they needed to be completely victorious over the biological entities of the galaxy. The vast majority rejected it's help, believing it better to use their own tech and not be beholden to another power. But a small minority, the Heretics, decided that sounded just peachy. The Heretics left peacefully, and then started playing havoc on the Galaxy.
By default, the Heretics would have been on the side of the Reapers. They'd already picked their side. Even if the bit was flipped to make them align back with the "True Geth," they would have still had the original motivation to strive for True AI.
Legion is playing a game of maths. The Heretics were already on Team Reaper; destroying the station deleted 6.6 million Geth programs and 2.4 million Geth platforms, as well as a centralized staging area for the Geth. This makes this the "correct decision." Reprogramming the Geth would have still lead them into joining the rest of the Geth on Team Reaper when the Quarrans re-open the war, but with millions more programs, platforms, and server capacity.
The Geth eventually give in to the Reapers as a necessary means of survival, because the Quarrans destroy the Geth Megastructure... destroying millions of programs, platforms, and massive amounts of server capacity. It's possible that if the Heretics were reprogrammed, and their station left intact, the Geth would not have had it's intelligence dimmed by the destruction of the Megastructure, and would have been a seriously distracting, very motivated and intelligent, fighting force acting in their own interests, while also leaving open the idea that the formerly Heretic geth may push this more powerful Geth fighting force at the reapers ANWAY to gain True AI.
By destroying the Heretics in ME2, Shepherd ensures that they end up underpowered in ME3 when the Quarrans destroy the Megastructure. Yes, the Geth put themselves under Reaper control due to this (and have therefore increased the fighting power of the Reapers), but they're a less effective fighting force overall with the loss of BOTH chunks of Geth (and the galactic residents do not have to fight a two front war).