Wa alaikum as salam,
Brother you raised very valid question and it proves that you are learning things rather having blind faith in anything. Learning is part and parcel of life and we must continue our journey of getting educated until we reach in grave.
There are very certain reasons because of which Imam Ali (as) never took part in any war during the first three calpihs and I can summarize as below-
1. First three caliphs were not legitimate one and they had usurped the rights of AhleBait (as) and for further reading on the subject you can read Sermon in Nahjul Balgha especially Khutba e Shiqshiqya and its commentary.
2. Fighting under army of any of these 3 caliphs would have means that Imam Ali (as) accepted them as his leader and caliph. He had been offered role of commander of muslim army several times but he refused to take any positions.
3. Islam believes in spreading message of love and compassion and convert people's heart rather forcing them to convert under the blade of swords..Converting people with swords will create society of hypocrites and not of Momen and Islam needs momin not munafiq. Banu Umayya clan is best example of munafiq who got converted to Islam after conquest of Makka due to threat to their life.
Some people believe that Imam Ali (as) pledged his allegiance to AbuBakr after 6 months. that is completely rubbish, he just withdrawn himself from robe of caliphate and was busy teaching people essence of Islam. He even refused to accept allegiance of muslim community after murder of Usman but accepted after much deliberations and acceptance by the community that they will obey his all commands. Talha and Zubair were first to pledge allegiance to Maula Ali (as) and first to break their Oath. Few people used to write in their historical claims that they were forced to pledge allegiance though Imam Ali (as) never forced allegiance on anyone. Ibn Umar refused to pay his allegiance and Maula Ali (as) didn't force him at the time when Talha and Zubair paid allegiance.
4.Expansionist ideology of different caliphs and muslim rulers is not teaching of Islam and hence Maula Ali (as) refused to take part in any of wars under first 3 caliphs.