Why is Mitty reluctant to change his "self" when he is around his wife?
It is an interesting question. If Walter can imagine himself as a successful, confident man, why doesn't he try to actively convert himself into such a success in his real life? There is no definitive answer to this question. Perhaps he is simply too inept, too shy, or too self-doubting to make such a transformation. He may have tried and failed. Thus, he is discouraged from ever trying again.
It seems just as likely that he is at least somewhat happy with his current situation. Even though his wife treats him like a absentminded child, he always has an escape: his imagination. If he is satisfied that this escape allows him to get away from his wife and his real life, then why would he change that? If this escape is his only means of happiness, he might be afraid to change anything, fearing that any change might affect his desire to retreat into his daydreams. In fact, if Walter had been living this kind of double life for years, it would have become habit. Likewise, accepting his role in their marriage and his wife's complaints about Walter's flaws has also become a habit. He is used to his double life. Walter might also like the dichotomy of having a bland, miserable existence and an alternate reality where he is the hero. That is, he might enjoy the sudden drama of the change from middle-aged, frustrated man to epic hero.