Its been 46 years, there have been opportunities for peace along the way if they wanted it. It would have required compromises though.
Iran's not war not peace policy is an expensive one, both directly and indirectly (e.g. turning them into a parriah state). In the end it seems like its also been largely ineffective. Instead of keeping them out of war, proxies like Hamas ended up drawing them into one, and it ended up being a pretty one sided war not in their favour. Although i suppose prior to that point it was yielding geopolitical gains.