Cooperative task execution, a hallmark of eusociality, is enabled by local interactions between the agents and the environment through a dynamically evolving communication signal. Inspired by the collective behavior of social insects whose dynamics is modulated by interactions with the environment, we show that a robot collective can successfully nucleate a construction site via a trapping instability and cooperatively build organized structures. The same robot collective can also perform de-construction with a simple change in the behavioral parameter. These behaviors belong to a two-dimensional phase space of cooperative behaviors defined by agent-agent interaction (cooperation) along one axis and the agent-environment interaction (collection and deposition) on the other. Our behavior-based approach to robot design combined with a principled derivation of local rules enables the collective to solve tasks with robustness to a dynamically changing environment and a wealth of complex behaviors.