Slightly educated guess: did you install the x64 emulator between when you had the problems and when they went away?
I can see brew trying to run x64 code while the emulator isn’t there blocking code from running in weird ways.
Alternatively, it might be that package updates fixed the packages that behaved incorrectly. Again, just a slightly educated guess.