Toras Nistar teaches (especially the writings of the Ramchal) that just like before creation, there was only the unity of the Creator, and creation seemingly brought multitudes of creations, with separations and differences, and these are (seemingly) increased through not doing the Will of HKBH, which distances us from Him, it is our job through serving HKBH to bring all of creation back to absolute unity with the Creator again. This process starts in this world and continually through different stages of Olam Habaa, increases that absolute unity. It is teshuva which, when separated from HKBH through sin, brings us back to closeness, deveikus and eventually unity (Yichud). It's like a Klal u'Prat u'Klal.
That's the purpose of creation, in a nutshell.
For this reason, the mitzvah of vahavta le'rei'echa komocho is the klal (general principle) and greatest visual example of what all mitzvos do, in their own ways. All of the mitzvos and Torah, in general, are meant to bring us together, in unity, with our neshamos, with Klal Yisrael, with all of creation, and with HKBH.