You replace the recipe result for locomotive with locomotive parts. Those then get put into the construction site.
And now I have to ask: Why? Why not simply use the original locomotive as ingredient in the construction site?
Using the original locomotive would not break existing assembly chains for locomotives and would allow put locomotives back for construction after destroying a train. Same with cargo and fluid wagons.
See also my next suggestion: Destruction site.