Hi!
I don't think there is a way to get a database name from an interwiki prefix.
Not a good/easy way, AFAIK. I've looked into it recently and the way current code does it is with a lot of ad-hoc stuff, external configs, hard-coded configs and special cases. I think this ticket: https://phabricator.wikimedia.org/T113034 aims to improve it.