To supplement Jimmy's answer, if they had to land right away, they could have; it just would've resulted in an overweight landing being recorded, and which on most airliners triggers a special inspection of the landing gear and its attaching structure, and if nothing is permanently bent or cracked or broken, you are good to go.
An overweight landing in itself shouldn't result in damage unless the landing was hard, the overweight condition using up some of the structural safety margin, and if you know you are landing overweight you will take extra care to land smoothly.
Depending on the airplane, an overweight landing may apply a "penalty" so to speak, accelerating some inspection interval, or advancing a life limit on a structural component in the gear, or some other negative impact maintenance cost wise. So there may be a significant incentive to avoid it from a long term cost perspective even if it means wasting 5 hours of fuel going round and round in a hold.
In the case mentioned, the crew would have consulted with the airline's Maintenance Control organization on the private company radio frequency to discuss whether to land overweight or not, and if there wasn't an urgent need to land, the Capt would have agreed with Maint Control and burn off the fuel to avoid the overweight landing and its ramifications.