It is sad but yeah, it was necessary in this case. A tranquilliser can take up to a few minutes to take effect and would not have guaranteed the kid's safety.
The overall issue however is not whether it was justified in this case but the zoos themselves. It is absolutely evil in my eyes to entrap animals in cages and exploit them for entertainment. The entire zoo industry is disgusting and needs to be rid of.
Unsurprising unfortunately