One thing I love about Pirates of the Caribbean is that as much as they’re chasing after a life of freedom and without a governing body or laws or social constraints, their lawlessness doesn’t free them from the consequences AND THEY KNOW THAT. When Jack is first explaining a life of piracy to Will, he says the only rules that matter are what a man can do and what he can’t. To all those that have no familiarity with it, they think this means pirates just go around killing whoever they want. And in a sense they’re right. But Jack goes on to explain that they’re not free from the consequences of their actions and have to reconcile with that, preferably before committing said action. So he can kill Will right then and there and have a nice quiet voyage to Tortuga, but he would be too shorthanded to actually make port.
True enough, they have the code, which is regarded and enforced as law. But that’s only because deviation from the code often has negative consequences compared to the inconvenience of adhering to it. Once everyone starts acting on their own, everything continues to degrade. Elizabeth kills Jack and as a consequence they need to get him back for the meeting of the pirate lords. Will conspires with the Singapore pirates to take control of the Pearl, while they are also conspiring with the East India Company to take the Pearl for themselves. As a consequence, the EIC has everyone at their mercy. It’s not until they return to the code and start negotiating with each other that they’re able to get on the same page and escape.
Then things get out of hand again at Shipwreck Cove until one man says to “hang the code,” for which he is immediately killed. Captain Teague, in his many years of experience, knows that it’s better to kill one of their own than have him start acting on his own and ultimately getting them all killed or inspiring others to do the same. Only by keeping to the code and electing a king to lead them in war were they able to claim victory.
So yes, their piracy is a claim to freedom. Yes, they still have a law. But the law is designed to keep them free.