The degree of cooperation that can be attained in an open dynamic system fundamentally depends upon information distributed across its components. Yet in an environment with rapidly enlarging complexity, this information may need to change adaptively to enable not only cooperative interactions but also the mere survival of an organism. Combining the methods of evolutionary game theory, agent-based simulation, and statistical physics, we develop a model of the evolution of cooperation in an ageing population of artificial decision makers playing spatial tag-mediated prisoner's dilemma games with their ingroup neighbors and with genetically unrelated immigrant agents. We study the behavior of this model in the presence of four conditional and two unconditional strategies, and we introduce the concept of time-varying tags such that the phenotypic features of 'new' agents that invade the system from the outside can change into 'approved' following variable approval times. In a series of systematic Monte Carlo simulations, we observed that ingroup-biased ethnocentric cooperation can dominate only at low costs and short approval times. In the standard 4-strategy model with fixed tags, we identified a critical cost c crit above which cooperation transitioned abruptly into the phase of pure defection, revealing remarkable fragility of ingroup-biased generosity. In our generalized 6-strategy model with time-varying tags, the maintenance of cooperation was observed for a much wider region of the parameter space, reaching its peak at intermediate approval times and cost values above c crit . Our findings suggest that in an open system subject to immigration dynamics, high levels of social cooperation can be attained if a fraction of the population adopts the strategy with an egalitarian generosity directed towards both native and approved naturalized citizens, regardless of their actual origin. These findings also suggest that instead of relying upon arbitrarily fixed approval times, there is an optimal duration of the naturalization procedure from which the society as a whole can profit most.