The Bible doesn’t say that Adam was lonely in the Garden of Eden, just alone (Genesis 2:18, 20) in that there was not yet another creature among all of the animals comparable with Adam. On the 6th day, God also created Eve so humanity could fulfill God’s command to be fruitful and multiply; fill the earth and subdue it (Genesis 1:28).
Likewise, the Bible doesn’t say that God felt all alone and created man to fill His purposeless days and soothe His empty nights.
In His prayer the night He was arrested by the Jewish mob, Jesus prayed,
You have sent Me, and have loved them [the disciples] as You have loved Me. Father, I desire that they also whom You gave Me may be with Me where I am, that they may behold My glory which You have given Me; for You loved Me before the foundation of the world (John 17:23, 24).
God is love and before the Earth was formed or Adam walked in the Garden, the Father loved His Son (1 John 4:8). Perfect love existed in eternity!
We weren’t created as a balm for a very needy God with an empty heart. The truth is, we have done everything but love Him, yet He has still made us the recipients of His great love. Behold, what manner of love the Father has bestowed on us, that we should be called the children of God (1 John 3:1).