Try with this https://docs.phalcon.io/es/latest/reference/events.html
I've not tested much things that Phalcon offers, but I've read it and not seems difficult. The only part is at the beginning, with the "can be as verbose as we need it to". Try copy-pasting the beforeQuery method and send an echo with a die (for example) to test that it works.
Sorry not being of more help.
(PD: no idea what is multi-tenant control xD)
Ah, database sharding, now it sounds more clear to me (but a little, I didn't learnt it in deep).
The last thing that I can tell you is: did you try to return a new $connection with the modified sql inside? Maybe that works.