On of my DS's had very much the same problem. Constant massive constipation until he was over 5. When the poo emerged it stank particularly strongly due to having been held inside the poor child fermenting away.
This is my experience and I may be completely off-beam so take what I say with a pinch of salt but..... And I'm sorry it's long, but it needs to be. Here goes:
We went through horrible years of treatment with Movicol, enemas and various other laxative preparations. My DS always wore pull-ups, and he often stank. He was admitted to hospital for brief stays for enemas and so forth. Not only did he not get better, but he found the whole process of having things repeatedly shoved up his bottom so traumatic it was a horror for both of us.
I pushed for a referral & we were sent to St Thomas's, the London Teaching Hospital. They did motility testing on him, as well as a long psychiatric assessment. The motility test involved him swallowing lots of tiny pieces of plastic that they could track as it passed through his gut by doing scans.
Turned out my DS has a variant of Hirschsprung's disease. Essentially his bowel lacks some of the nerves that respond to create peristalsis. Using more sophisticated scanning equipment than our local hospital did, they showed us that the plastic took days to move, and that my DS had soft non-impacted faeces backing up right to the top of his large intestine and that this seemed to be normal for him. The plastic moved far more slowly, with times when it hardly moved. Completely differently to what you'd expect in a normal gut.
Treatment was by firstly stretching his anus under general anaesthetic. A combination of far too many enemas and his own desperation to hold his poo inside had made his anus far too tight. They eased it up, and stretched his rectum a bit too. The doctor said part of the problem was the enemas, which had mucked up any natural sensation to poo he might have. The trouble with Hirschrpung's disease is that the normal sensations we all have that tell us to open our bowels are either very faint or, if you're unlucky, completely absent.
The next stage was teaching my DS to manage his own bowel. Hirschprung's disease can be very serious, but people with mild cases like my DS can learn to live with it.
The doctor explained to him my DS was 4.5 at the time that he would need to learn to "listen" for any desire his bowels had to move, and to go to the lavatory in response to even the slightest message. He told him to sit and wait, and be patient, and to expect a very, very large soft poo. He should not get up when it finished, but stay quietly, as more might easily be on the way if he gave it time.
The doctor stressed that bowel movements would not happen every day or even every few days, but that the most important thing was not to feel pressured to poo more often, but be confident that as long as he started concentrating on his bowel he would be able to develop his own pattern. He just needed to be determined and pick up on the slightest urge. The doctor as very firm that there was no need for daily bowel movements, as previous doctors had said. Once a week was fine. My DS had a mega colon, which stores huge amounts of poo.
The psychiatric angle turned out to be very important. We were told that, unlike my DS, most of the children with faecal incontinence on the ward were not suffering from anything specific, but that the incontinence itself had become a habit because it gave the child control.
A child might have a reason to want a great deal of maternal attention after a divorce for example and an episode of severe constipation might have shown a child how to gain all the attention the child yearned for. Most of the kids used incontinence as a way of ensuring they kept their mothers by them. The incontinence meant they were not forced to separate from their mums for any length of time -- going to school and self-toileting, for example.
The key diagnostic indicator from the psychiatrist's pov was the child's feelings about the incontinence. He said "If you or I lost control of our bowels we'd be absolutely horrified. We'd be hideously embarrassed. Well, when you interview these families, the parents are naturally desperately worried but the child seems pretty relaxed about the situation. If the child isn't very upset about what is a very humiliating situation we know there's a behavioural issue."
This is by far the most common cause of prolonged faecal incontinence in kids and, if it rings any bells with you this may be helpful. Exactly how distressed is your DS about the smell and indignity? Is there a possibility that the initial real illness has turned into a way of keeping you close?
My DS was terribly embarrassed, and desperate to stop it happening. Having no psychological cause or element simplified things. The solution was by getting my DS to understand his own bowel.
Amazingly, the doctor's careful explanation to my little DS (remembering how young he was) took root. My DS took it all in with great concentration. He learnt to manage his bowel. He was so proud when he managed it, and he did it all by himself with the loo door shut. He became very private about it, and very soon stopped talking about it at all. He stopped taking laxatives, but when he does use the loo he passes the most enormous amount. He goes about once a week. He doesn't even think about it now. It's just a fact of life.
Maybe once every couple of years he'll need a dose of senna. He needs at least 8 tablets to get a result, because the nerves in his bowel respond so sluggishly.
Sorry this is so long, shortpants, but I hope this is helpful. It might be relevant.