I thought that solar systems and galaxies are disk-shaped because that is the most stable shape under gravitation. Globular clusters are very old, often times older than their host galaxies, so why haven't they flattened out?
In order to result in a disk-like stellar system there are two conditions that need to be satisfied. (a) The initial gas from which the stars form must have a significant ratio of rotational to gravitational energy. (b) The star formation would have to occur slowly enough, that the gas collapses to a disk before star formation is complete.
The formation of a disk from a spherically symmetric state requires a reduction (more negative) gravitational potential energy, whilst conserving angular momentum. This can only happen if there is some means to lose energy from the system in the form of dissipative interactions.
A pure stellar system is almost collisionless and there is no means to dissipate energy. That means once a spherical system of stars has formed, there is no way for it to become more disk-like. Thus if star formation takes place in a spherical way, then those stars will end up in a spherical system. Only in cases where the gas collapses to a disk before star formation occurs do we end up with disk-like systems. This is true of the disk of our Galaxy (and of the solar system).
In the case of globular clusters (and other types of star cluster in the Galaxy) it appears the star formation is rapid enough that the gas cannot have collapsed to a disk before most star formation is complete. NB. Many globular clusters do have measurable rotation.
While some galaxies are disk-shaped, others (elliptical galaxies) are more spherical. Disk-shaped systems are those in which conservation of angular momentum of the star-forming gas played a central role; for more spherical systems, this was not the case. Globular clusters are thought to form in the densest portions of gas in galaxies with the highest external pressure, possibly resulting from collisions of gas clouds. In this case, the initial angular momentum of the larger-scale gas distribution is irrelevant, and the dynamics of the gas on much smaller scales is more important.
To put it another way: it is not the case that disks are the most stable shape under gravitation; spheroidal or elliptical systems are also stable equilibria. The physics of collapse and formation determine the final shape. For globular clusters, the initial angular momentum of the gas is likely irrelevant because they condense out of much smaller pockets of gas.