Doing a single marathon, let alone 2, is a bad idea, if the Ironman race is important to you. Chances are, the investment of time and money into the Ironman, compared to a marathon, make it more important than a marathon, to most athletes.
But the key here is that any major effort, like a marathon, is highly risky. The chances of breakdown and injury are very high, and there is no need to do a marathon. Your stand-alone marathon time has little to do with what you can actually run in an Ironman. What you can run in an Ironman depends more on bike ability, training hours in the saddle, nutrition, and race execution. Look at the marathon times of the athletes who run "fast" in an Ironman, and they will tell you that training at that intensity is very easy. It's not about their stand-alone marathon.
Even if an athlete doesn't get injured from the marathon effort, they will certainly require at least 2 weeks of recovery time, with light activity, plus a 1 week taper minimum. Do 2 marathons, and all of sudden, you've lost 6 weeks of training time, a month and a half! If you do a 2 week taper into each, you've lost 2 whole months!
The key to performing well in an Ironman is consistency in your training, never going over the edge into injury, and coming to the start line confident, with a plan you know you can execute. This comes from months of dedicated preparation, sometimes years!
If you're planning to do a marathon and an Ironman in the same season, my suggestion is to do a half marathon, and keep yourself healthy and consistent in your preparations for your Ironman.