Tuco wouldn't have known if there was another thug or two waiting outside the door, or if all three were dead (Muloch wasn't) so the safest exit in that moment for him seemed like through the window. And did make an unexpected start to the film though !
No, it's only the unexpected start Leone was aiming at, not the logic. Once Tuco made certain there was no fourth man (assuming you are right), he should have taken care of the 3 once and for all. Why running away like mad? That is a ghost town. But, of course, Mullock had to come handy later: but to Leone, not Tuco.