An engine requires piston that move within a bore. To create the pressure that process has to be precise. This process was perfected in making cannons.
Why I like this story is that it embodies the unintended consequences that underlies so much of progress, like Alexander Graham Bell inventing the telephone while trying to create something for the deaf.
You see this with research now that's plagued with being goal-oriented. "What will you discover/prove/invent in the next 5-10 years?" Who can say?
Also, the steam engine and the internal combustion engine are directly the products of technology created for war to kill people.