Whether or not the retreat was wise is still up for debate because, let's face it, the writers are very inconsistent over the events and details leading up to his desertion on the field.
What I do believe for sure is what he does AFTER the retreat is not wise at all. Supposedly, this giant horde of monsters that Calain's and Loghain's armies cannot defeat on their own and are marching northward into Fereldan. So, what does Loghain do? Why, withdraw his troops completely from the south, march them into the northernmost corner of the country, and call all nobles (who in turn take their private armies) up there with him. Yeah, leaving the entire southern border wide open and unarmed peasants with no way to defend themselves is a brilliant move. Telling people the darkspawn were too numerous and powerful for his and Cailan's army to defeat while leaving the border wide open AND insisting it's not a Blight will get people to believe you.
Then he declares himself regent right after the king has died at the hands of the monsters he fled from, leaving him and his men conveniently without a scratch. Again, right after leaving the southern border wide open (indicating they're not a threat) and then telling people they were too powerful to defeat (indicating you're lying). Yeah, people won't think you're lying about the danger to take leadership and trying to scare them into rallying behind you at all.
Again, I think the writers' retcon of Loghain's motivations were very sloppy. Originally he really did leave Cailan to die because a) he knew Cailan was planning on leaving his daughter to marry the Empress of Orlais,

this fueled his paranoia about Orlais conspiring to take back Ferelden (the way it's presented in the game, his Orlais obsession seems random), c)
he really did believe the darkspawn were not a big threat. He really thought they were mindless raids and that he could defeat them easily once he put his mind to it. He thought he could afford to use the darkspawn to kill Cailan and the Grey Wardens, use Cailan's death to usurp the throne, use the threat of darkspawn to rally the nobles behind him, and then take out said darkspawn swiftly. once his position was stable. (It goes with the on-going theme of excessive pride leading to downfall in the game, and Flemeth saying "Perhaps he thinks the darkspawn army is a threat he can outmaneuver. Perhaps he does not see that the evil behind it is the true threat." "The Archdemon.")
What I find to be the most inconsistent characterization of all is this half-hearted retcon that "Yeah, he left Cailan to die, but he didn't plan on doing it beforehand" and "He only did so after realizing how numerous and unconquerable the darkspawn were at Ostagar." First, if he knew the darkspawn were too numerous/organized, then why bother with the Tower of Ishal? The whole point of that sequence was he and his men couldn't see the battlefield and so needed someone to let him know when to charge. If he could see the battlefield and knew they were too numerous, organized, and undefeatable with the troops they had, then that means he must have lied about the need for scouts on the Tower, which itself indicates he planned betrayal beforehand. (Doesn't help that Loghain's men close the tower before the battle to "secure it" and then it gets infiltrated within thirty seconds. Again, probably a leftover plot thread from when the writers were sure Loghain planned betrayal beforehand, but leaving it in leaves more inconsistent plot threads.)
Secondly, if Loghain knew the darkspawn were that numerous and organized,
it's not consistent with his later actions of leaving the southern border wide open and dismissing them for months. Not taking them seriously as the true threat, dismissing them as not really a Blight, and assuming he can wait to deal with them for as long as it takes to secure his political dominance are not consistent with the supposedly honorable man that fled only after genuinely realizing they were a much bigger problem than originally anticipated. If Loghain quit the field and then ignored the darkspawn for months because of excessive pride in his abilities and underestimation of the darkspawn's capabilities (i.e. multiplying, organizing, expanding, using cunning strategies of their own), this would be consistent characterization throughout the game. Saying he quit the field because he knew they were a problem but then treated them like they weren't a problem through the rest of the game is inconsistent characterization.
I'm not saying he can't be a complex tragic fallen anti-hero by leaving Cailan or underestimating the darkspawn, since we would still have the (I guess) understandable motivation of wanting to save the kingdom from being retaken by the empire that occupied them for a century (even if the hypocritical racist **** has no problem selling elves into slavery to assure human freedom), but it would make his actions and characterization more consistent.