I would bet 10:1 that it is not the keyboard, but the software.
Your combos work, so it is obviously not an issue with ghosting.
What could happen is something along the lines of:
1. you press Caps+S
2. you press J
3. AHK starts sending a long text which takes a while
4. you release all keys
5. AHK is busy and does not process CapsLock up
6. Windows sees the key and toggles CapsLock state
7. AHK is finished and listening again, but confused by the CapsLock state
I'm not saying this is what happens, or that AHK works exactly that way. Just an example of how things fail.
I've used AHK for 10 years daily to use CapsLock for extensive cursor controls and special characters, and I ran into a couple of "WTF is happening here??"
In the end I wrote my own software; I can't recommend it to you since it doesn't do combos with multiple character keys (like S+J".
Check the AHK script log ("Press [F5] to refresh") and troubleshoot... would be my approach.
And don't let me discourage you from buying a new keyboard. One can never have enough keyboards

update: this is what I used in my 'final' AHK config:
;activate capslock with Lshift+Rshift, release with Rshift+Lshift
LShift & RShift::SetCapsLockState On
RShift & LShift::SetCapsLockState AlwaysOff
Also: check if the order in which you release the three keys makes any difference
SOAPBOX: THIS POST VERIFICATION IMAGE THING SUCKS, BRUTALLY.
Can we please have an AI that decyphers these images? I need 8 attempts on average