I was also having the same issue on MacOS 12.0.1 and brian 2.4.2 but your solution seems to have worked!
Just for the record: We just merged Helpful compile error on Unix by mstimberg · Pull Request #1367 · brian-team/brian2 · GitHub and while it does not directly fix the issue, at least now the “Cannot use Cython…” warning also includes the following note:
Certain compiler configurations (e.g. clang in a conda environment on OS X) are known to be problematic. Note that you can switch the compiler by setting the ‘CC’ and ‘CXX’ environment variables. For example, you may want to try ‘CC=gcc’ and ‘CXX=g++’.