So how will Trump pull out of this and correct course? He has a long period of judicial activism to undo. Not impossible, but certainly not easy.
First of all, he needs to stick to his guns and not let his inner circle of advisors do anything more than advise. He's the President, and they're NOT, for good reason.
It's his gut instincts that got him to where he is today. He needs to seek his own counsel when faced by a crisis like this, and trust that those instincts still serve him, as they always have.
He is now the President of The United States of America, and must fully assume and accept that mantle. It's probably the most important thing he can do at this early stage of his presidency.
He's been accustomed to being the boss for most of his adult life, so I'm sure it will come easy. What I'm sure hasn't come easy for him, is the level of gross insubordination and push back he's now receiving from those he views as his underlings.
I think Trump has more of the 'right stuff' to do this job than anyone in living memory. He just needs to be who he is, and get on with it. Everything else will fall into place.