If you don’t think he would act that way or be discouraged then I think you have missed something about the entire saga. Try watching TESB and TLJ back to back. Then tell me that TLJ isn’t in character. Yes, in ROTJ, he is more confident, but confidence can be shattered easily. Luke has shown that to be the case. Insisting that he maintain the confidence that he has for most of ROTJ is unrealistic. The unsure Luke we see in ANH and TESB is just hiding under the surface in ROTJ and only needed a sufficiently horrible event to bring it out.
In my view you missed something in the saga, because you keep going back to TESB to argue Luke in TLJ is consistent with his portrayal in the OT. The problem is you view Luke as this flawed static character. Luke in ROTJ is just the same character as in TESB with a little more confidence. Take that confidence away, and add a few years and you have Luke from TLJ. However, you ignore much of Luke’s character development in the OT. The Luke that let himself fall to his death rather than accept Vader’s offer, is not the same character as the one who left Yoda and Obi-Wan on Dagobah, and that’s without considering the time he’s had to reflect on the consequences of his actions. Then there’s his development in ROTJ, where after being goaded by Palpatine, and Vader to release his anger, at that seminal moment he realizes he will follow in his father’s footsteps, if he doesn’t let go of his fear, and anger. So, he throws away his weapon, and declares himself a Jedi. These are scenes of critical character development, that you just seem to ignore. The Luke at the end of ROTJ is not the impetuous naive, youth we met in ANH, nor is he the impatient hothead from TESB, nor is he the overconfident Jedi wannabe at the start of ROTJ. He is a fullfledged Jedi, in tune with the Force, and able to avoid emotions affiliated with the dark side of the, such as fear, anger and hatred. That is his arc in the OT, his hero’s journey. You say:
“Try watching TESB and TLJ back to back. Then tell me that TLJ isn’t in character.”
What you’re really saying for the Luke of TLJ to be in character, he has to regress back to the character he was, when he first entered the cave on Dagobah. To me that’s one of the running themes in the ST: regression. Han regressed back to smuggler, Leia regressed back to the leader of a fledgeling rebellion, the galaxy regressed back to the Galactic Civil War, and Luke regressed back to his younger stupid self.