If cocaine had positive effects that outweighed the negatives then it absolutely should be prescribed. But it doesn't. Unlike methylphenidate - which for most people has fairly mild downsides at the doses it is usually prescribed in. It is also largely non-addictive with little evidence of long-term health damage.
Also unlike cocaine.
All in all, I'm not sure how this comparison helps.
https://en.wikipedia.org/wiki/Methylphenidate
Though I'll grant you we don't have data for long-term effects.
https://www.sciencedirect.com/science/article/pii/S014976341...
Further, as you pointed out does have benefits (which is I assume why it's prescribed). Cocaine and meth have similar effects btw (pros and cons), abuse is what causes the issue(s). People can survive on both for decades though.
Granted, I am happy for you and I think drug laws are ridiculous.