How important is it to work in industry before attempting a PhD?
From my experience in CS in Canada, most student do not have industry experience before doing their Ph.D. And I have not seen this as a requirement for entering the Ph.D either.  The reason is that a Ph.D. is not an industrial project although it could be related to the industry in some cases. But it does not need to.  During a Ph.D. the goal is not to commercialize a project. But it is to advance knowledge in a given field. Some people do a Ph.D. project in collaboration with a company. But from my experience, most people don't. So to answer your question: it is not important to have industry experience. But it can help. Perhaps that you will know how to better manage your time, etc. and this may be help in carrying your Ph.D project.