You seem to be very confused on these issues, Jeremy. The most serious error is at the end but I shall deal with that first.

"It's actually natural degeneration, the second law as applied to systems that are in fact struggling for their own existence doing work to outpace the second law."

It has become fashionable in pop-science media to describe entropy as a universal driving force, Peter Atkins and Eric Chaisson are among the original promoters of this nonsensical proposition and. somehow it has caught on.

You write:
"It's actually natural degeneration, the second law as applied to systems that are in fact struggling for their own existence doing work to outpace the second law."

1. All our observations actually indicate a consistent overall increase in intricacy of our universe with time. We call such a process evolution!
2. This evolutionary process, this increase in chemical and geometric intricacy, requires work to be done. It is a fundamental tenet of physics that whenever work is done it is accompanied by an increase in entropy. This can arise as a result of friction, for instance, or by matter becoming less structured or less concentrated, or ultimately, by energy becoming more "smeared out".
3. Thus the observed universal increase in intricacy inevitably results in an associated increase in entropy.

So entropy is properly regarded as a by-product of evolution. Evolution's "exhaust gas", if you like!

What then drives the process of ever-increasing intricacy, of universal evolution? Within the current stelliferous era, at least, we can identify its sole ultimate energy as gravitation. Gravitational collapse lies at the root of all but the simplest matter (atomic species) and all subsequent increases in chemical and geometrical intricacy. Including ourselves!

You write"

Incidentally, evolutionary processes do not, as is often claimed, contravene the second law of thermodynamics, which specifically applies only to spontaneous processes. Whereas evolution is a driven process. Whether any process is ultimately spontaneous is perhaps left to philosophers. :>)
You write:
"So if the universe doesn't start with agency or function, how do the emerge?"

1. It is by no means certain that the universe had a start.
2. Agency or function (in its purposeful sense) are not required for evolution to occur. Quite sufficient is a source of driving energy, an element of randomness and suitable machinery. The latter being represented by the laws of chemistry and physics. Which provide constraints on possible paths.'
You write:
"To say that a gene is selfish doesn't explain it but attempts falsely to explain it away. A molecule or a pattern within a molecule isn't struggling for its own existence "

I agree on both counts. The selfish gene notion has caused much misunderstanding.
You write:
"Some phenomena is functional, other phenomena is not. Function implies an agent, a beneficiary."

Not necessarily. As I was careful to point out in my original comment, "function" can be used in two different senses (actually three. if we include its maths use). One of these does NOT have purposive connotations.
You write:
"Machines are purpose-built by engineers. I don't bet you want to imply that."

This arises simply from the habitual belief that WE are purposeful, that WE design, WE invent.

But except within a trivial everyday human context we find that if we look more carefully the supposition has no substantive basis.

For it can be argued, with strong evidential support, that we do not, invent or create artifacts or systems but that , rather, these are more properly viewed as having evolved within the collective imagination of our species.

To quickly put this counter-intuitive view into focus, who would not agree that the following statement has a sound basis? :

We would have geometry without Euclid, calculus without Newton or Liebnitz, the camera without Johann Zahn, the cathode ray tube without JJ Thomson, relativity (and quantum mechanics) without Einstein, the digital computer without Turin, the Internet without Vinton Cerf.

The list can, of course, be extended indefinitely.

Hope that all helps you to get these things straight. Good luck with your future cogitations.