Maybe malic acid did enough to flush it out of your bile duct, but it couldn't keep it from getting caught along the way before you could expel it--until you ate the apples. In my search to get better, the first thing I was told when I became constipated was that apples are a mild laxative--they soften and loosen everything up.
Did you examine it closer to see what it was: food, stones, or maybe something too old to tell? If you couldn't tell what it was at all, maybe it's been in there for a LONG time...and good riddens! If you have candida, wait a few days to let your body get better from eating the apples and try more on an empty stomach. If you don't have candida, you may want to consider adding apples into your diet once a week. Either way, give it another try and see what happens. Maybe there's more in there waiting to come out :)