To use the scaffolding metaphor more completely, I'll just make some notes about actual construction scaffolding that can be applied to the discussion. Scaffolding is usually something designed to be easily built up, torn down, reconfigured, and reused on future projects. Sometimes, though, a project is outside the norm by so much that custom scaffolding is required. The custom scaffolding is still cheaper and makes the job easier than working without it. If there's no need to reuse it then it's sometimes cheaper to make the scaffolding a one-off than to make it reusable and reconfigurable for the next job. The materials can at least be recycled.
In code, your reconfigurable, reusable scaffolding might include things like test suites, IPC code, and commonly used modules. Some custom libraries might be bolted on here and there, and then those can be binned once this project is through with them. Perhaps some parts of those custom bits can be salvaged, but there's no reason to engineer them for indefinite reuse like the rest of the scaffolding because chances are your next job or the next phase of your current job will require something completely different. For the parts that really make sense to make reusable and generic, go ahead and do that piecemeal as those bits get used. For the parts that don't, don't bother with the up-front investment for very little return. Just do what gets you to the next part of your current project, and save notes on any really innovative bits in case you do need to replicate them. Tear down the scaffolding when you're done and the project is self-contained, and keep around the truly globally applicable bits on your truck.
If it makes sense for your project to contain an exact copy of some of your scaffolding upon completion, leave it in there. If not, just use the scaffolding to support you while you build something more permanent. Sometimes you want to build something grand that stands the test of time, but sometimes you just need to assemble a place to stand while you build that.
I've written this whole thing thinking about using scaffolding in construction and remodeling. If it sounds like programming, that's just the strength of zby's choice of metaphor. :-)