charlie and alan were heavily neglected by their mother; after their father's death while they were both still young, she was more focused on marrying men that didn't care about her sons and sending them off to focus on herself and her relationships. but she also played favourites, often praising charlie and referring to him as if he's her only son, often forgetting alan entirely or diminishing his accomplishments; this could be because of charlie's success and alan's cheapness and leeching... but who knows. while they both hated her for her seeming lack of care towards the both of them, they both wanted to be the favourite, to gain her approval and praise over the other. this was most likely because of her neglect in the first place, it made them desperate to get what they didn't as children. this created an emotionally incestuous dynamic between alan/charlie and their mother, individually their mother deeply affected the way they had relationships. charlie could not hold them, and alan could not get them. this made each other the only constant in their lives, aside from their other family members. they did not know life without each other, and they went to each other for help rather than friends; this is shown all throughout the series, but mainly in the pilot when alan is thrown out and calls charlie first, letting himself in before even asking because his brother was always the one a phone call away
in "sarah like puny alan", they talk briefly about their childhood, and how their father was gone (and they never mention a stepfather, because none of them stuck around long) and their mother was off doing her own thing. it's a short conversation but shows how they were neglected and alan says that they were "taking care of each other like when [they] were kids". they took care of each other because their mother and stepfathers did not. for a long time, they were all each other had. their fathers death caused the older brother, charlie, to become alan's older male figure, whether he wanted to be or not. and he saw his younger brother as both someone he needed to protect and take care of, and someone who took care of him. it's also shown how attached at least alan is to his brother after charlie dies; he begins to dress like him, drink like him, talk like him, introduce himself like him. he has never known life without him, and he tries to keep him alive through himself while getting to live as the man he wanted to be; his brother who outshined him, who was always the favourite, the successful, the womaniser. his jealousy is VERY prevalent throughout the series, when he picks fights with charlie about his habits with women
charlie and alan's upbringing caused them to attach themselves to each other, because they did not have anyone else. they did not have caring parents or close friends or genuine relationships with women; everyone pushed them away or stayed away from them. their traumas from their mother and how they were raised created an unhealthy, emotionally incestuous bond between them, one that they used as children to keep themselves alive and sane, but carried on into their adulthood