They did know beforehand, an AP article said as much:
“Upon learning of the former president’s request, we approached it through the lens of one of our core values: we open our doors to everyone,” the company said. “McDonald’s does not endorse candidates for elected office and that remains true in this race for the next president. We are not red or blue – we are golden.”
They could’ve theoretically played it that way, but they didn’t. They said they got the request and approved it.