Yes, there are indeed nonconscious functions or processes. So what?...
The panpsychist position doesn't have it that consciousness/experience evolved from something else. It's been with us (or with the universe) since the very beginning - perhaps since just after the Big Bang. Thus the advantageous/not-advantageous-to-survival distinction doesn't seem to be that relevant in the case of panpsychism.
It's certainly possible that all the brain functions and processes (which David Chalmers often refers to) might well have occurred - and could still occur - “in the dark”. However, not all of them do occur in the dark. (As Philip Goff puts it: Consciousness is a primary "datum in its own right"; which - by definition - can't be ignored.)
As to how experience/consciousness is added to - or comes from - these functions (or from the brain itself), then that seems to be a different question. And it is indeed problematic and difficult.