Not being able to see the whole end of the engine, It's hard to tell, but I'm going to take a guess at what was done.
The long line coming across the top of the EGR valve plugs into the port on the end of the upper intake manifold. Correct? Then the other end plugs into the cruise control dashpot that you picture?
I think what was done is that a hose was routed direct from the manifold to the cruise control, possibly to correct a leaky hard vinyl line that runs underneath the manifold. The original would exit on the passenger end and plug into a rubber piece near the MAP sendor that has two inlets and two outlets. The two outlets go to the metal line on the trunk wall and eventually one of them finds its way to the rubber hose you have with the bolt in it.
The cause of the intermittent check engine light is likely the EGR system. It could be a bad EGR valve, bad EGR solenoid, or a vacuum leak in one of it's hard lines or EGR tube. If you check the trouble codes it will probably have a Code 32 stored in the ECM.