Quite amazing information we learned here!
As far as the chameleon irrationalities are concerned, you mentioned the chameleon trying to squeeze himself in small gaps whereas he can shoot a cricket down from far away with extreme accuracy; or being stressed by the presence of crickets.
I suggest a theory that would need validation of course, but it could explain what happens

As their eyes are on a binoccular vision "mode" when trained at the same target for both the left and right eye, like in hunting "mode", they have full 3D vision and can perfectly assess distances and sizes. But a small gap between branches, when close enough to the animal, gets outside of the binoccular area of vision, and isn't percieved in 3D any longer - this is due to the fact that eyes are positioned laterally on the head and there is a dead angle between the focal distance and the chameleon where 3D sight is compromised.
A cricket passing by on one side of the animal is also hard to evaluate in distance terms; and some insects do bite or sting: it could trigger a defensive reaction when the animal has trouble assessing the size and distance of anything alive next to him.
Horses work a bit the same way with their almost lateral eyes: their 3D vision is quite impressive, I've seen them assess distances to a small branch and avoid it with one leg when getting there; but the dead angle causes them to scare off when getting close to, say, obstacles, where they suddenly cannot see the obstacle as well when it gets close, and they suddenly stop, throwing the rider in the bushes

This restricted 3D-vision area is the reason why problematic or very fast horses are often ridden with the head tied low down to avoid their assessing greater distances and running with more confidence.
Maybe this could help elaborate the ideas and find a more zoological explanation to their sometimes odd behavior.