Operating trains is literally the origin of "engineer". It was a job that required significant application of accepted rules and methods to calculate acceptable speeds for cornering, hill climbing, and hill descent, especially when they were all combined. Getting outside the acceptable speed ranges could be catastrophic in every single one of those cases, and acceptable speeds could vary significantly depending on weather, train length, and train weight. The job was all about understanding how to correctly apply all the rules and control the vehicle to stay within safety factors.
There were probably earlier usages of the term too. As the article says the Civil bit came about to distinguish themselves from the older profession of Military Engineers.