Two things are going on, and the more interesting one is that the gym is the anomaly, not the crag.
Gyms are deliberately over-protected. They are commercial facilities with insurance, a duty of care to complete beginners, and an interest in nobody ever getting hurt on their floor. Dense clipping also means the rope is never far away, which suits a room full of people learning to lead. That is a design decision about a controlled environment, and it sets an expectation that outdoor climbing was never built to meet.
Outdoors, the person placing the bolts is usually a volunteer. Each bolt and hanger costs real money, the anchor costs more, and the labour is hours of hanging on a rope with a drill. A route with fifty percent more bolts costs fifty percent more and takes fifty percent longer, and nobody is reimbursing anyone.