The stall torque for any electric motor is the torque that it delivers when the shaft is prevented from turning. That may also be the maximum possible torque, but the maximum torque for operation more than a very short time is usually much less than the stall torque. Some motors must be electrically limited from developing stall torque even for starting. Limiting torque is generally done by monitoring the motor current and limiting the voltage to keep the current below a set limit while starting.
Nothing inside a motor "causes it to stall." A motor stalls if the torque required to turn the load exceeds the torque-producing capability of the motor.
why does it not just provide the same amount of torque the whole time
A motor produces only as much torque as required to turn the load. A motor's torque capability varies with speed as illustrated by its torque vs. speed capability curve. The torque required to turn a load also varies with load as illustrated by the load's torque vs. speed demand or requirement curve. If the motor has adequate torque capability, it operates at the intersection of the two curves. If the motor is adequate for continuous operation of the load, the operating torque does not exceed its continuous torque rating.
The torque vs. speed capability of a motor is determined by the type of motor, the specific design, and the motor-controller or power-source capability. The continuous-torque capability is determined by motor losses, heat-dissipation capability and the temperature limits of its wire and other components.