Sounds like my BIL...he acts really badly, says he is always right, gets defensive, everything is always someone else's fault, won't accept any advice EVER, would argue that the rain is wet if he decides it is NOT etc etc...almost impossible to deal with.
I am so sorry for you, there is alomst nothing you can do as he sounds like he cannot operate on a rational, adult level.
You either accept you actually have him as an additonal child FOREVER or distance yourself to protect yourself and your daughter. If anything happens to you, she will cop all this crap, he is not someone who will ever take responsibility for himself.
On your comment that when he is nice he is lovely I would say: he is just nice enough of the time to make sure you stay around and pick up after him as he can't be bothered to do anything for himself. He is a taker through and through.
I know this sounds harsh but after years of my git BIL I have no sympathy for this character type. Their only talent is to find nice people to parasite onto. A total drone in the hive.