Is there a way to download a list of all Wikipedia categories?
This is really a general MediaWiki question, not a Wikipedia question, since there's nothing special about Wikipedia in this regard.
There is a stable, documented, way to obtain a list of all categories from a MediaWiki server. It is documented in the MediaWiki API documentation. You simply need to write, or obtain, a tool that makes use of this protocol.