If there is a published 1) EGT limit and a 2) TO/GA time limit, which one should be applied when the EGT is well below the EGT limit and possibly even below the 'max continuous' EGT. Particularly with consideration of terrain avoidance procedures that require climbing to a high altitude (10,000 ft) for terrain avoidance.
The TO/GA time limit and the EGT limit are hard limits mandated by the approved flight manual. They must be adhered to independently and cannot be traded off between the two.
Takeoff performance is calculated so that if a safe altitude above terrain and obstacles cannot be reached within the time limit, aircraft mass must be reduced rather than the TO/GA time increased.
Having said that, if things don’t go as planned during takeoff e.g. for reasons not known beforehand, I‘d recommend to bust the time limit rather than fly into the side of a mountain, if the choice is only between the two...
The term may also be ITT limit (Inter Turbine Temperature).
On most engines there is usually a 2 minute to 5 minute limit on EGT/ITT and N1 (fan rpm) for both Take-off/Go Around power, and APR (Automatic Performance Reserve) power (the balls-to-the-wall thrust setting the engine automatically goes to when the other engine quits).
On most FADEC engines, the most forward thrust lever position will take you into APR for both engines and the FADEC will manage things at those limits for you, so you know you can slam the thrust levers full forward without burning up the engines in an avoidance emergency. Same for TOGA. You just have to observe the time limits.
On an older non-FADEC engine, you have to observe the limits and stay within them manually with the thrust levers. On a go around for example, the pilot flying will press the TOGA button, move the thrust levers up to TOGA thrust more or less, and call "set thrust", whereupon the pilot not flying fine tunes the thrust levers to the TOGA setting bugs indicated on the N1 gauges, also monitoring to keep the ITT limits from being exceeded.
However, on a Holy Crap Emergency like a cliff in your face, on a non-FADEC engine, where it's balls to the wall or die, you accept you're probably going overspeed and overtemp, and maybe wreck the engines. Too bad for them.
In any case, 2 to 5 minutes is plenty. The most likely case where you would even have the engines maxed out for any substantial period that eats into a 2 minute limit significantly would be a windshear escape, but even that might burn up a minute at most (that would require a downburst 2 miles across).
The margin between maximum ITT and the ITT seen during TOGA setting is the main (but not only) indicator of engine health and life span. An engine will have a minimum margin, and as it wears out the ITT margin gets slimmer and slimmer until you're at the limit and off it comes.