You have two fundamental points in this subject:
Such an agreement as made with G4S for the Olympics is a contract which is enforceable by law and may be subject to penalties if not fulfilled.
The public sector (basically Government Departments) are very poor when it comes to negotiating contracts.
As a result G4S appear to have obtained a contract where all the benefits are on their side with little in the way of penalties if they failed to perform.
Such contracts are far from uncommon as those for military equipment, trains and similar demonstrate.
What is required are good negotiators employed by Government to obtain a balanced contract and a good enforcement of the contracts with substantial financial and other penalties. Such a system would minimise the likes of the recent G4S problems.