So why did our heroes take the crazy roller coaster mine cart ride to escape instead of just leaving with the liberated children in Indiana Jones and the Temple of Doom?
IN UNIVERSE: There was no other way out at the time.
After Indiana, Willie and Short Round free the children from their chains, the children start running toward the opening of the cave to escape. While the children are escaping, Indiana gets stopped by a man and fighting ensues.
Short Round and Willie stay behind to try and save Indiana. While we see this fight happening on the rock crushing machine, there are several bad guys standing around the same opening where the children had already escaped. Indiana realizes this after his fight and yells at Short Round to get into the cart. The Maharaja also knew that there was a way out through taking one of the carts:
INDIANA: Short Round! Quit fooling around with that kid and get into the cart! Now!
SHORT ROUND: Okie dokie, Indy!
MAHARAJA: Please listen. To get out, you must take the left tunnel.
OUT OF UNIVERSE: The mine cart chase scene was cut from the first film in the series, Raiders of the Lost Ark.
George Lucas wanted there to be a mine cart chase scene and could not use it in the first film, so he needed a way to create it for this film:
So, the first ideas Lucas presented for “Indy II” involved scenes that were cut from Raiders, including the mine car chase and the skydiving raft sequences. In Raiders, the mine car sequence would have taken place in the climax after the Ark is opened, and would have showed Indy and his companion, Marion Ravenwood, loading the Ark on a mine car to escape with the rest of the Nazis in pursuit. Modified versions of both sequences ended up in Temple of Doom.