I noticed this on a big tree years ago, for some reason it started dripping sap. ( right onto my car ) which caused permanent stains.
In your 2nd and 3rd pictures, the sap is coming out at points that have been injured, so it could be the plant "feels" stressed and is over producing sap to heal its wounds.