...You should connect your Electrum server with your full node and then your Electrum client with your Electrum server. Now you can create a wallet by importing private keys and it'll return you their balances.
If you have any questions tell me. I'm willing to help you achieve all the above, I just find it honestly a loss of time for you....
Although as you said it's pointless no matter what, for efficiency it would probably be easier to write something the queried the electrumx database directly instead of using the client.
I agree, although querying database directly require you to understand how Electrum server software (e.g. ElectrumX and electrs) design the database. Alternatively, since different implementation still follow Electrum Protocol (
https://electrumx.readthedocs.io/en/latest/protocol.html), you could create script to perform communication with Electrum server through JSON RPC.