This is super interesting. I absolutely love AHK, too. But can you please clarify how you achieve, "caps is esc if used alone, control if used with another key"? Is it based on whether the key is still down (pressed) vs. up (released)?
If you don't mind, can you please share your script? My Capslock-as-a-modifier setup is very simple. I just use Capslock + various keys to do stuff:
Capslock & p::Send, {PgUp}
Capslock & n::Send, {PgDn}