Ensure proper semantics when replacing all tasks in a goal.

Testing Done:
ci in flight.

Reviewed at https://rbcommons.com/s/twitter/r/1220/