Since loving our neighbors is the second of the two commandments that cannot be broken to keep another, perhaps these two are related to each other somehow.
Let's look at the commandment to love God with our whole beings in greater detail.
Hear, O Israel: The LORD our God, the LORD is one. Love the LORD your God with all your heart and with all your soul and with all your strength (Deut 6:4-5, NIV).
The heart is that part of us that makes decisions, wherefore loving God with all our heart means that we acknowledge that God is the source of all wisdom, wherefore in all of our decisions we choose to obey God's commandments (1 Kings 8:61).
The soul refers to the part of us that is alive, that holds the breath of God (Genesis 2:7), wherefore loving God with all of our soul means that we acknowledge that God is the source of our lives wherefore we desire to be united to God (Psalm 42:1-2).
Our strength refers to all the things we will do during our time on earth, wherefore loving God with all of our strength means we acknowledge that God is the source of our strength, and that in all we do we seek to glorify God and give him praise (Psalm 96:4).
Hence the commandment to love God with our beings includes all of our decisions, our spiritual vitality, and our physical strength. We cannot omit any part if we are to love God with our whole beings.
When we look at the commandment to love our neighbor the way we love ourselves, one thing becomes immediately clear: since our love for our neighbor is connected to our love for God (1 John 5:2), we know that our love for God is a guide when it comes to loving our neighbors the way we love ourselves.
It isn't possible for us to hate another human and love God with all of our hearts, for God commands us to love our neighbors, wherefore we must choose to love, and love does no harm (Rom 13:10). Think about it: if we aren't allowed to hate our enemies (Matt 5:43-48), how can we hate our brothers and sisters?
But, you say, not every person who isn't a brother or a sister is an enemy. There are lots of people whom we feel nothing towards, who are strangers to us. Since we don't feel anything towards them, neither love or hate, what should our response towards these people be?
Our response to other humans should be the same as our response to God; if we claim we love God with our whole beings, we must also love those created in the image of God with our whole beings. That is the material point in the writings of James:
With the tongue we praise our Lord and Father, and with it we curse men, who have been made in God's likeness. Out of the same mouth come praise and cursing. My brothers, this should not be. Can both fresh water and salt water flow from the same spring? My brothers, can a fig tree bear olives, or a grapevine bear figs? Neither can a salt spring produce fresh water (James 3:9-12, NIV).
Yet, that we love even our enemies doesn't mean that we turn away from justice when people oppress and hurt others. The concept of loving our enemies doesn't mean we won't call them out when they act unjustly. It refers to our refusal to perpetuate violence and oppression, for if we become the oppressor, we no longer love God with our whole beings, for God is just, and expects us to act justly. If we wish to love God with all of our beings, we must also obey the commandment to seek justice for the orphans and widows of this world (Jas 1:27), and that means we must confront those among us who oppress. In other words, if we wish to love God with our whole beings, we must also love our neighbors with our whole beings, for a love that doesn't engage our minds to seek justice for all, our souls to seek equal opportunity for all to thrive, isn't a love that will cause us to spend our energy making the world a better place. We will most certainly love ourselves, but self-love doesn't get us very far when it comes to obeying the commandment to love our neighbor the way we love ourselves. And that will cause us to also fail to love God with our whole beings, for how can we love God if we only love ourselves?