Barbarika's joining Pandavas army and having 3 arrows would have itself made the Kaurava's army weak, so Barbarika could have then joined Kauravas. Now, if Barbarika joins the Kauravas army then the Pandavas army would have been weak. So, it would have been confusing for Barbarika in deciding what to do, which side to join. And in the process of joining both armies one by one he would have killed everyone and he himself would've been the lone survivor.
And even if we consider him joining the Pandavas army for a minute, then also here could be some other things that needed to be considered:
Bhishma: Bhishma had got the boon of Ichcha-Mrityu so he couldn't be killed by even Barbarika, and if he would have survived and rest others are dead then Barbarika had to join him as then Kauravas side would have been weak.
Jaidrath: If he had killed Jaidrath than Barbarika's head would have also busted thus killing Barbarika.
Karna: Karna couldn't have been killed until he had his Kavach and Kundal.
So, either full Kauravas army wouldn't have been killed then and ultimately Barbarika had to join Kauravas and end all Pandavas along with their army, which was possible as Pandavas do not had any such boon like Bhishma or Karna to protect them OR Barbarika himself would have been killed by killing Jaidrath.
Also, there were some pledges taken by Pandavas brothers like Bheema for killing Dushasana, Pledge by Draupadi for not tying her hair until she washes it with blood of Dushasana, Dhristadyumna being born with the purpose of killing Drona, Amba's pledge that she will the reason for Bhishma's death, etc. There were several boons, curses and pledges that needs to be settled through this war. So, ending the war through Barbarika was not destined.
Also, another reason for cutting Barbarika's head was a story about the previous birth of Barbarika in which he was cursed that he will be killed by Lord Vishnu's incarnation before Lord eliminates the evil forces on earth. This is described on this Wiki page as follows:
Barbarika was a Yaksha in his previous birth. Once Lord Brahma and several other Devas came to Vaikunta and complained to Lord Vishnu that the Adharma on Earth was increasing; it was not possible for them to bear the tortures causes by the wicked people. Hence they came to seek the help of Lord Vishnu to check them. Lord Vishnu told the Devas that he will soon be incarnated on Earth as a human being and destroy all the evil forces. Then, a Yaksha told the Devas that he alone is enough to kill all evil elements on the Earth, and it was not necessary for Lord Vishnu to descend to Earth. This hurt Lord Brahma very much. Lord Brahma cursed this Yaksha that whenever the time comes to eliminate all the evil forces on Earth, then Lord Vishnu will first kill him. Later, the Yaksha takes birth as Barbarika and Lord Krishna seeks his head in charity as a result of this curse.