Why did they fight Makedah only after finding the kings?
Malbim: Initially he thought that the kings are alive (and they will gather soldiers again and come to fight), so he was afraid to fight Makedah, lest he be attacked in front and in back (the cave in which the kings hid was outside of Makedah 1 ).
If he was sure that the kings are in the cave, he did not need to wait until he found them. He could place guards at the opening! If he was not sure that they are in the cave, it would not matter where it is! Perhaps he was concerned for another exit from the cave (e.g. a tunnel), and Malbim explains why he attacked Makedah only after he killed them. (PF)
Why does it say "Ka'asher Asah l'Melech Yericho"?
Radak: This teaches that they did not seize Melech Yericho alive and hang him afterwards, like they did to Melech Ai and the five kings. Rather, they killed him among the others, like it says here "va'Yakeha l'Fi Cherev v'Es Malkah."