To my understanding, organisms evolve in order to adapt to their environment and
Suppose there are two mutations that would allow a species of plant to gather more sunlight for energy, one that would make it grow taller than competing plants and another than would make it grow wider. The species happens to evolve to grow taller. It is true that it might have achieved the adaptive function of gathering more energy without growing taller (i.e., by growing wider instead). So, growing taller was not necessary (i.e., the only way) to achieve this function. Nonetheless, it would be a mistake to say that the plant's height is causally irrelevant to its capacities to gather energy from sunlight.
Similarly, it might be that a species (call them p-zombies) might have evolved that could gather and synthesize information about various features of its environment just as well as us but without being phenomenally conscious. But the possibility of such a species tells us nothing about whether phenomenal consciousness in us (and other animals) plays a causal role in gathering and synthesizing information about our environment. Consciousness may have been selected for even if p-zombies are possible. Consciousness may be the particular way (among many possible ways) that our ancestral species solved the challenge of gathering and synthesizing information about the environment and using it to guide adaptive behavior.
If your p-zombies are physically identical to us in every way, then we might wonder why consciousness evolved. But this already assumes that consciousness plays no causal role, since that's the only way that a physical duplicate of us without consciousness could still behave just like us. Once we recognize this, the conceivability of p-zombies becomes much more dubious (at least to me). I have a hard time conceiving of conscious states as causally inert, in part because I assume conscious properties are essential properties of certain underlying neural states.
(Another possibility is that consciousness was not selected for but was a side-effect of some other adaptation, but this still allows that consciousness eventually took on important roles in our behavior.)