Written and sold as a comedy, I think there is more to Mrs. Doubtfire than initially meets the eye. Forgive me for taking a silly crossdressing Robin Williams comedy too seriously, but here I go!
Firstly let's examine why the marriage failed, and, more specifically, whose fault it is. It's mostly Daniel's obviously, but here's where it gets a little tricky.
Is Daniel's behavior a result of the fact Miranda is the breadwinner and not him? I.e., is he irresponsible because he has a well-paying but disposable job and thinks he can do whatever he pleases and damn the consequences because Miranda will always pick up the tab? Or is their situation a result of Daniel's behavior, i.e., Miranda needed to become the breadwinner because her husband is so irresponsible and outspoken he can't hold down a job for very long?
It may be a bit of both. But however you put it, neither scenario exactly paints Daniel in a very good light. I don't think he realizes how good he has it. He has a job doing what he enjoys but can and does quit it on a whim when it clashes with his personal morality, and he can do so without any immediate financial consequences because his wife is the one bringing home the bacon. He comes across as a guy who is extremely intelligent, good-hearted and creative, but who has never really known a day's hardship in his life. His intelligence likely let him breeze through school and he also likely had a ton of friends due to people enjoying his impersonations and jokes, talents which likely made it relatively easy to get a job voice acting.
Miranda, meanwhile, doesn't have that luxury. Her job is harder, likely required a lot more schoolwork, studying, and long, hard hours at the office. And while it's a little petty to say so, her job is also arguably of more merit to society than being in the entertainment industry. So it must have been hurting her for a long time to see Daniel have everything come so easy while she had to struggle for it, and, worse, to then have him be incapable of holding onto it and be prone to throwing it away whenever it suits him, putting all the heavy lifting onto her.
Daniel's lack of responsibility doesn't end with his marriage, though. As much as I can agree with him about smoking in cartoons, it's pretty obvious he thinks very highly of himself and his own personal morals, and the fact he quits in the middle of post-production while making fun of (if not outright insulting) his co-workers, shows he has no sense of responsibility as an employee of the cartoon studio. I'm not saying he shouldn't be allowed to voice his opinion about smoking, but there's a time and a place for it, and the middle of a recording session is not it.
Another interesting possibility for why Daniel is the way he is, is that he wants to be more responsible, and is simply lashing out in some kind of weird midlife crisis type thing that likely began a few months or a couple of years before the movie takes place, and him quitting his job and then wrecking his marriage by not only giving his son a birthday party, but also a noisy and destructive one, is the culmination of it. However you look at it, Daniel is clearly a damaged person who has difficulty functioning in the real world.
Now then. Having thoroughly dissed Daniel, let's examine how I think this movie is actually about his redemption and transformation into a more well-adjusted adult. Or at least the first steps towards it. Specifically, the fact I don't believe the movie condones anything Daniel does. If it did, it wouldn't make Miranda so sympathetic. Or Stu.
Then there's how Daniel reacts to the divorce. By creating a double life and becoming immersed in a fictional character. And for what? To spend more time with his kids? While I don't doubt Daniel genuinely loves his children, the level of precise planning he put into the scheme to sabotage Miranda's efforts to find a nanny so that she'd all but have to choose Mrs. Doubtfire (i.e. him) seems more like simply his vengeance against her. Then here's how he treats Stu. Passive-aggressively insulting him, flipping him off behind his back, breaking the hood ornament off of his car, and, ultimately, almost killing the guy.
Instead of simply going with the flow and accepting what has come to be, Daniel, in his typical immature way, attempts to use his acting abilities to worm his way back into his former home life, and not only does it actively jeopordize his relationship with his children, it also ends up almost killing someone. And yet, ironically, in so doing, he is being more proactive than ever before, actively pursuing what he wants instead of waiting for it to come to him as usual, but he's doing it for the wrong reasons which is why it all falls apart.
Sure, starts becoming more responsible and strict and a better father to the kids than ever with Mrs. Doubtfire's emphasis on rules and good behavior, but I still think the initial decision to even invent Mrs. Doubtfire and look after the kids after Miranda explicitly forbid it was just him wanting to stick it to his ex. I can't believe he expected the charade to last; there was no way he could've kept it up forever, further reinforcing my belief that the Mrs. Doubtfire plan began as simply him wanting to have his own way no matter what Miranda said, but became something he wanted to hold onto once he realized how emotionally rewarding it was to instill his kids with good values. But even then, it's highly irresponsible of him to continue to try and maintain the scheme past a certain point when he has to know there's only one way it can end.
And to further emphasize the point regarding how the movie feels about Daniel and his decision to become Mrs. Doubtfire, there is Mr. Lundy. At first glance the subplot involving him has nothing to do with the main story. And this is true. To a point. The Mr. Lundy subplot at once has nothing to do with the Mrs. Doubtfire story, and everything to do with it. I said above that in choosing to become Mrs. Doubtfire and not wait for opportunity to come knocking at his door like he used to do, Daniel was becoming a more proactive man, but ironically for entirely the wrong reasons at first. Equally ironically, is that, completely unrelated to this, a great opportunity does fall right into his lap. He didn't need to become Mrs. Doubtfire. Him meeting Mr. Lundy, and Lundy liking his ideas for the kid's show, all would've happened anyway. The only difference is Daniel would've pitched Lundy a different character idea for the show. So the one time Daniel should've simply waited, he didn't, and he's just lucky it still worked out the way it did and that Lundy still gave him the show.
And I think the moment where this realization comes over Daniel, the moment Mrs. Doubtfire, as an actual person whose existence he's trying to maintain against all logic and reason, isn't when he's found out at the restaurant, but immediately before it. When Stu is having an allergic reaction to the pepper Daniel put into his food, knowing he was allergic to it. Here is when Daniel realizes that his selfish and needlessly vengeful actions are about to cost someone their life, and he risks exposure to save Stu. He succeeds... and is exposed. And his reaction seems to be one of, better to be unmasked now doing a good deed, fixing a problem he created, than later under different and less heroic circumstances more comparable to when his son walked in on him in the bathroom.
And I think this why Miranda gives him more visitation rights at the end. Daniel realizes what a heel he's been, redeems himself by saving Stu's life, and makes an impassioned speech at the end. The judge, who doesn't know Daniel, made the right ruling, I think; he ered on the side of caution and I can't fault him for thinking Daniel was just acting. But Miranda, who knew her husband probably better than anyone, could tell when he was acting and when he wasn't (at least when she knows for certain it's him!), knew he'd changed. The ruling would've been appropriate for the old Daniel but not the new one.
And the best part is, even though he realized what a jerk he'd been, it's debatable whether Daniel even deserved the second chance his ex gives him. Miranda owed him nothing. But she came to him in good faith anyway and gets the court order rescinded. Because she knows that if Daniel's change for the better isn't encouraged and nurtured now, he will likely just relapse into his old, irresponsible self in a few years. So Miranda, always having been the better person through and through, goes out of her way to ensure her ex can become better, as well, even though she didn't have to.
And also, at his new job, Daniel has found a way to impart moral lessons to kids without disrupting production. He has a better working relationship with those around him. He is good friends with Mr. Lundy, and I even like to think it was he who went out of his way to encourage Lundy to keep the old show's host around as a supporting actor in the new show instead of just firing the poor guy. Daniel has learned to treat people with more respect and think of more than simply himself and his own opinions.
Hence, this is why I think Mrs. Doubtfire can be looked at as the story of Daniel's self-destruction and finally his eventual redemption, or at least, him being given the chance at it, thanks both to his own realization at what he almost cost himself, and Miranda's kindness towards him. In short, Mrs. Doubtfire is a movie that tells us it's never too late to change for the better.
Or I'm just overthinking.