Make TaskBuilder methods return self to support Builder pattern.

Fix #6399.

(At least in principle, though Niko has noted in the comments there that this might not accomplish everything one might have desired.)