The child needed to be hogtied, the officer most likely felt his life was in danger.
The kid could have easily went for his gun, then before you know it, there will be a deadly situation. There would be a struggle over the gun, the police officer will try to shoot the kid, but the kid would grab the slide and push the gun to the side, causing the chambered round to miss and the casing to not eject.
Music from a 60 person orchestra will begin to play from some random location.
The 5 year old kid will eventually land a really strong punch knocking the police officer back and him just happening to drop the gun.
The kid will then dive for the gun but the officer will get there a split second before, and within a few millimeters, knock the gun further away.
Both will then continue to fight, getting slammed into walls causing parts of the concrete wall to shatter and the pieces to fall down in slow motion.
The fight will rage on for about a minute, before one of them slams the other into a window and both fall out.
The fall will then happen in slow motion and the fight will continue on the way down with somehow gaining rapidly changing/ sweeping camera angles and movements. The orchestra will play more strongly, then the fight will end with one landing on a car roof and surviving, while the other falls on the harder ground.
So now you see, the police officer prevented all of this from happening by hogtying the kid.
Consider that the next time you think a police officer is using excessive force on a kid