Pipes would either be flexible, or rigid but assembled in sections, so you'd disassemble the pipe while pulling it out.
On the other hand disassembling two miles of a segmented pipe like the ones used for oil drilling in an hour or two does sound pretty ambitious. Drilling pipes are - according to a quick search - up to 45 ft long, so one would have to unscrew more than 200 connections. One could use longer sections but that will probably complicate the handling at the surface and might not actually help in terms of time.