I think you could make a case that corporations already take on some of the economic roles traditionally associated with governments, but they don't seem to have taken on the legal protection roles yet. However, I could see a future where the perks of employment include access to corporate retained lawyers. Or maybe corporations will hire lawyer secretaries to allow their employees to cut through government bureaucracy (e.g. to contest credit rating inaccuracies on an employee's behalf).
Another possibility would be the corporations and the cities associated with them sort of work together to act like city states. It definitely seems like the laws of San Francisco/California are informed by their association with tech and provide extra protections for the people living there (or at least the people living there who are employed by tech companies).