Horrible Thor Plot Hole
Thor is basically a god of love and goodness. He can't pick up his hammer unless he does so with goodness in his heart.
Such a person would be extremely courageous.
Superman, for instance, has lost his powers and continued on trying to help people because he's not afraid to be harmed to do good. The definition of courage is to do something good when when you're afraid to do so.
Thus, a robot, like we have in reality, cannot be courageous because they aren't capable of fear. So, Thor was portrayed as a coward here. He lost to Thanos, got scared, and they crumbled into a slobbish, depressed, crazy person.
In this film, he's only okay with fighting evil if he's knows he's stronger. That means he's a coward.
Thor is not a coward and to show him suddenly as one is a plot hole as it violated the psychology of the character.
Lots of crap in this film, but I enjoyed it at the time. But, given time to think there was a lot of screwed up stuff.