I had exactly the same thought. I surmise that Trump the Gambler doesn't make decisions with any sort of analysis. It's all about his whim. Doubt that anyone here would disagree, and many have observed the same.
Under that scenario, there's a 50-50 chance he could make a proper decision, provided that some other bias doesn't force him in the wrong direction. Such would certainly occur in regards to an issue that had a previous Obama decision-stamp on it: he'd reverse a good decision regardless. That's the reason he gutted State Department, and the reason he expelled all the US Attorneys vulnerable to it.
But in the matter of Barr, I cannot be sure what factors made him put Barr in as a nomination. He knew he'd have to get Senate approval, and someone may have suggested Barr. So maybe the entire country got lucky, just for that.