The way I see it, before Billy gets the power, he is forced into a family he doesn't want, and just give up about the whole find his mother thing. So he acts kind depressing but that's not his true nature.
After he gets the power, he suddenly has everything, he has superpowers and he "can take care of himself", which is a thing he wants very badly. He even has a friend, which he never have one before. So his inner child which was buried before was unleashed. The important thing is, after he gets his power, the way he act when he was Shazam was actually pretty much the same comparing to him being Billy, so imo there isn't really much problem here.