Contracts that violate local law are void in just about every jurisdiction, as are contracts against clearly defined public policy. In many cases, laws are specifically designed to restrict otherwise valid contracts; for instance, in the US, an employment contract that pays less than $7.25 an hour will normally be invalid, even if the company and the employee both agree to the reduced wage. In employment law, where contracts are fairly common, the laws would be virtually meaningless if contracts took precedence.
In the case of independent contractor status vs. employee status, California law does not consider someone to be an independent contractor just because their contract says so. "Independent contractor" is defined in California law to be
any person who renders service for a specified recompense for a specified result, under the control of his principal as to the result of his work only and not as to the means by which such result is accomplished. (California Labor Code, section 3353)
If this definition isn't satisfied, it's irrelevant what the parties agree the status is; it's not an independent contractor status. According to the state department of labor, the test is that found in Borello v. Dept. of Industrial Relations (a California Supreme Court case), which lays out a multifactor test for contractor status and says that
The label placed by the parties on their relationship is not dispositive, and subterfuges are not countenanced.
Likewise, with product liability, a country can generally have laws mandating liability for people providing a product or service; the extent to which this happens depends on the jurisdiction. For instance, India may not want a big company like Uber to be able to block liability claims by putting some legalese in front of average consumers who aren't able to make a detailed risk-benefit analysis. Alternatively, India could decide that Uber is better able to take the risk from bad drivers than average consumers are, so the right policy is to assign the risk to Uber. Whether Uber should be able to avoid liability is something that every country can decide for itself based on public policy considerations; the point is that if they do decide that Uber should be liable for damages, their law trumps Uber's contract.
Uber actually tries to limit liability in their EULA, and to avoid an employer-employee relationship in their driver agreement. Their US EULA and driver agreement says they aren't a transportation provider and you aren't getting transportation from them, and even if you are they aren't liable for damages. However, if that provision violates the law in some state, the provision is invalid. Likewise, if they claim it's not an employment contract but it meets the "employee" definition in some state, it's an employment contract.