Canada has attempted to address this problem for adults as well as children with the introduction of dangerous offender status:We need a 3rd way here for these terribly violent crimes. I think there are some limits when it comes to legally putting such young criminals in mental hospitals, though.
We have a very out-of-date legal system when it comes to issues of insanity and mental health. We seriously need to update it. This is not the 1700s any more, and we know a lot more about human psychology.
Dangerous offenders are not mentally disordered (see CRIMINAL CAPACITY). Neither are they common criminals, even recidivists, to whom the ordinary sentencing provisions of the Criminal Code apply. They belong to that small minority of offenders who are neither deterred nor reformed by ordinary punishment and who pose a serious risk to the mental or physical well-being of other members of society. The indeterminate sentence permits these offenders to be controlled until their dangerousness abates.
[...]
Dangerous offender status is addressed in a hearing held after an offender is convicted of an offence. Before the ordinary sentencing proceedings commence, the prosecution must duly notify the offender that a dangerous offender application shall be made. The provincial attorney general (minister of justice) or deputy minister must consent to the application[.]
The prosecution must establish two main matters beyond a reasonable doubt in the hearing. First, the conviction must have been for a "serious personal injury offence"[.] [...] Second, the offender must be "dangerous." If the conviction offence involved non-sexual violence, the offender must constitute a threat to other persons' lives, safety or physical or mental well-being.
[...]
If the judge finds the offender to be dangerous, the judge has the discretion to impose the determinate sentence warranted by the conviction offence, or a sentence of indeterminate detention. This decision is based on evidence relating to the offender's potential cure and treatment. If the judge imposes an indeterminate sentence, the offender is entitled to a parole review within three years from the date the offender was taken into custody, and every two years thereafter, until release.
The implementation of dangerous offender status has been controversial at times, but it is one approach.
Edit: however, I don't believe anyone under the age of 12 could ever be determined a "dangerous offender". Dangerous offender hearings only happen after conviction, and in Canada, children under the age of 12 are considered not legally responsible, and cannot be convicted of a crime.