Others like NickB would give more informed comments. But let me give my sunday morning 2 cents.
As mentioned by others, this is a bit complex.
This is an AM ticket.
You were denied boarding on AM flight from MEX to EDI. Even though AF worked hard to reroute you on your outbound in cooperation with AM, it is the re-issued AM ticket that is at fault. AF offered you a nice alternative (option 3), but it is still AM ticket.
You were denied boarding on AM3 that is a flight to EU/UK operated and marketed by a non European carrier. I don't think that EC261/UK261 applies. Maybe it does because your ticket originated in UK, but I doubt. I don't know what kind of law a UK small court would use but it might be worth pursuing, although complex.