Is it really that different from court-ordered email dumps? FBI raids taking people's computers? Before email and the widespread use of computers these things weren't done, but I don't hear anybody saying we should go back to "the good old days" before computers and email because at least then we wouldn't have all this invasive government snooping.
Email dumps don't involve literal brain surgery with the risk of death.
Also, unlike emails, memories are fuzzy, subject to change, and to being dreamt up, drug induced, or all manner of other things we probably aren't ready to cope with, given all the other ethical problems we have in our justice system.