The power supply is simply a step for troubleshooting your issue - one that I have seen fix problems similar to yours.
One possible reason for the graphics card fixing, then failing again, is that you have a 12-year old iMac. Parts begin to fail simply from age (and heat, over time, will begin to break some electronic components down. Very often does not fail all at once, just a bit of weakening, losing some voltage here and there, and maybe not as much power capacity as it used to provide. One result from that is possible failure of a major part (such as a graphics card), then replace that with a good part, which works (for a while), then, because the real cause (a weakening power supply) is still there, and continuing to break down. Then perhaps causing a failure in the graphics card again, because of that same power supply.
Don't misunderstand me... This is not a guaranteed fix for every graphics issue, just one that I have seen a few times in the past. And, easier/cheaper to try than the next possible fix, the logic board.
It's always a good plan to think before you jump in to a repair that may cost more than the computer is worth, but also a good plan to consider what is happening from a real-world perspective, including listening to others who may have actual history in fixing an issue such as the one you have now. Isn't that ultimately why you come here in the first place?