I'm not sure you can call it an agreement in any true sense. Apple and Google dictated the terms for accessing the Bluetooth hardware in the particular way required. Many governments around the world wanted more direct access to the hardware than Apple/Google have permitted, or (voluntary or otherwise) access to location data. Google and Apple said if you don't agree to these terms, you don't get to access anything.
I'm not necessarily saying that's wrong or right. You could argue they're defending the user's rights against the tyranny of the British government. Or you could say they're constraining the user's and their democratically elected government's rights to voluntarily use data to help end a pandemic, while at the same time profiting off it themselves.