Google Maps (and even more so Waze which they own) already had partnerships with various brands - for example, type McDonalds into Google Maps (at least in the UK) and it has the M logo next to "see locations" as soon as you've typed Mc - so it's not such a huge stretch as you think it would be.
Despite not being privy to the details, I am familiar enough with this sort of marketing to be extremely confident that Google and McDonalds (and other big brands) did indeed negotiate specific terms including promotion of McDonalds locations beyond what is available to typical Google customers, rather than a McDonalds marketing manager just logging in and setting up some local campaigns.