A system of laws has nothing to do with capitalism. Pre-capitalist nations had laws, so did (and do) communist nations. Laws simply keep everything operating smoothly. And if you have an entity the size of a nation, you’ll need a lot of laws to cover the many issues regarding the many people in that nation. That has nothing to do with the economic system or the form of government.