The digestive organs do not operate on their own. There is a mechanism called the enterohepatic circulation where 90% of bile is circulated back to the liver. If this process is interrupted by very slow digestion, poor stomach emptying, the use of medication (eg amitriptyline), or recreational drugs, some of the most crucial bile salts get lost. These rare and hard to metabolise bile tend to act a detergents and keep the bile liquid. Without them the bile has a tendency to coagulate and soft stones form in the bile ducts.
All digestive problems involving the ileum result in some kind of biliary problem.