  We consider a quantum device $D$ interacting with a quantum many-body
environment $R$ which features a second-order phase transition at $T=0$.
Exploiting the description of the critical slowing down undergone by $R$
according to the Kibble-Zurek mechanism, we explore the possibility to freeze
the environment in a configuration such that its impact on the device is
significantly reduced. Within this framework, we focus upon the magnetic-domain
formation typical of the critical behaviour in spin models, and propose a
strategy that allows one to protect the entanglement between different
components of $D$ from the detrimental effects of the environment.
