Reinventing the wheel as a means of getting the job done is usually bad. Reinventing the wheel as a means of learning is good. We've all done that on some level. What else are the practices in books or the tasks we all completed learning something, than reinventing the wheel?
There's one great thing about a reinvented wheel. You can compare your solution with the solution(s) of others and thus learn more than by just writing code or just reading someone else's code. By implementing that wheel yourself, you get a much better understanding of the problem and can better appreciate or critique the decisions made by the other implementor. You can find better ways to write something than what you wrote yourself, you can find that your solution of a subproblem is shorter, but maybe has some drawbacks. You may even find out that your wheel is rounder, better spring-loaded, ... and generally works better. Or maybe not. But it was still well worth the time.