The soul might be no more than a bunch of frequencies that just happen to exist all around us. I will not surmise as to where they might come from at this juncture.
As an example, just picture the frequencies/codes being transmitted over the internet and just imagine that there are no computers connected to the web anywhere, except just for this one server connected to a small group of users that's pumping out information. All the other computers in the world are like soulless beings, but as soon as they connect to the server they acquire soul.
Maybe living organisms are like computers that as soon as they're conceived are automatically connected to unique sites on this ethereal universal web and thereby acquire a soul. When the organism dies, its connection (energy) merely transfers to another-similar organism at its moment of conception.
The soul transceives information with the 'server' during the whole of its existence, both receiving and transmitting information that A) guides the organism in all manner of things and B) adds to the knowledge already contained in the server... knowledge that is used for wish fulfilment, mutations and evolution.