It does in this case. If you do not follow McDonald's instructions and/or contract, they will terminate your franchise.
As much as you believe a franchisee has a right to use whatever machine they want, and repair it with whatever parts they want, that's just not how franchises work.
They are franchises, not individual restaurants. They do not get a choice over how long to cook the burgers, what size fries to offer, what grills to use, and what soft serve machine to use and it's sanitization standards.
There's an approved parts and vendor list for everything in a McDonald's restaurant. Franchisees basically get a catalog of approved things they can use.
McDonald's sells consistency above basically anything else. They have clearly decided having machines be inoperable is better than risking getting someone sick. The machine's are designed for inattentive employees with little to no training to operate effectively and safely. If the machine says "no go", then that's final. McDonald's wants that safety and consistency across all stores, and that is their right as the brand owner.
No Right to Repair law will change the terms of franchise agreements. Franchises that refuse to honor their agreement will simply be terminated. That's McDonald's right.
Honestly... as far as fast food franchises go, McDonald's is perhaps the most clean and consistent - given their massive size (double their next closest direct competitor). It's a marvel things are as safe as they are, given the varying quality and level of caring each franchise owner can have.
People cut corners when things get tough. A franchisee with autonomy over things like deep cleaning of the soft serve machine will choose not to do it if they can sell more (quite literally what people are advocating for in this very thread). It's not their reputation and brand at risk, it's McDonalds'.
Frankly, it's a good thing McDonald's exerts this level of control.
Contracts cannot remove all rights. For example, they can't force you to place yourself in harms way, or to harm others.
There is no law that forces McDonald's to extend you a franchise license. It's their right to run their brand how they want.
Part of the franchise contract would be an agreement to use their approved vendor/parts list.
If some law passed and McDondald's was going to lose control of franchises, consistency and their brand, they'd probably pivot to a mostly or entirely corporate-owned/operated model.
However, it's unreasonable to assert a franchise should be able to use whatever devices, machines, standards and consistency they want... which is what is being advocated here it seems.
As an aside, your example about refusing to sell a license to someone based entirely on the color of their skin would be quite difficult to prove and enforce. I'm not advocating for anything, just pointing out they can deny a license for pretty much any reason, or no reason, and nobody would be able to compel them otherwise. It is their brand, and nobody has a right to operate using that brand unless McDondald's allows it. That's the entire point of a franchise - use someone else's brand.
A contract does not contravene federal or state law.