If that's the case, it was some epic, truly epic incompetence / indifference. Because the port authorities were writing letters begging the judiciary to have it re-exported for years.
Doesn't every country have examples like that? Where the (local) government was or is aware of a dangerous situation, but it's expensive to do something about it, so they do nothing in the hope it'll go away or become someone else's problem?
I can think of two examples here in the Netherlands, the worst being Enschede, where a fireworks storage warehouse was built away from the city, then a new suburb was built on the nice empty grass around it. That went well until it didn't. It was known, but moving it involved a lot of hassle.
A similar tale about a gunpowder mill in the village where I grew up. When it was built it was outside the village. But that grew up to it. It took 4 smaller and larger explosions before someone finally decided that maybe the economic worth no longer outstripped the danger.
And those are examples in a rich country with the means to deal with the situation beforehand where the owners were clear.
Lebanon is poor, and as said, international cargo that is abandoned is a total legal quagmire. Sure, your theory of intentional delay because it *might* be sold to terrorist is possible, but everything points to it being at the bottom/middle of a large pile of problems with those involved hoping it would go away on it's own. Stupid, yes, but along the lines of Three Mile Island/Chernobyl