A lathe and some tools isn't that expensive. As a rough guess, that one is probably something like $20k worth of tools. Maybe double that including the cost of the floor space? Changing course and getting deliveries at sea is really expensive, so easy to imagine it'd pay for itself if you need it just once.
Zeppelins like the Graff and Hindenburg had machine shops onboard as well!
Their engines were very unreliable, they could do overhauls mid-flight. Airplanes around that time were just as unreliable, but flew shorter hops. Had to overhaul or swap their engines quite regularly between flights.
On a ship you can’t carry every spare part you might need. So you carry raw materials and have a machine shop on board to fabricate anything you need. Modern navies are very interested in 3D printing for the same reasons.
Cool Pictures! Lathe! Neat! I am an old school trained navy machinist. We use to hang the long stringy chips from the over head. The angle of the dangle = power of the puke in heavy seas.
BTW, US subs don't have lathes, well at least the smaller ones don't. You can do a lot with a hack saw, files, cold chisels, etc, if you have to. The small US frigates have a lathe, with a milling attachment!