Silly mistakes aside.
These are not variables being overridden... pkgname_i686 is just not a thing as far as makepkg is concerned.
The point of this is specifically disallow things like 'pkgname_i686' rather than just ignore them.
Also, this is nothing to do with overriding in a package function. Get rid of this section.
This section disallows overriding foo_arch, without it they are not checked. The bellow section lints the non architecture specific variables.
If there is a better way to do it or you think it would be a good idea moving this to a separate loop/file I would be glad to get your feedback. But just removing this section does stop the foo_arch linting.