Thanks for the suggestions.
I played around with your ideas and couldn't hash out the code to get it to work in a mcfunction. I don't think it's possible yet, because the commands currently don't seem to be tailored around external function files.
But it looks like 1.13 will make that possible, here's the projected command copied from Dinnerbone's github:
execute store result <name: entity> <objective: string> -> execute
Yep, store the result of the 'execute' into a scoreboard variable. Boom shakalaka baybee, problem solved. That previous sentence is poorly worded and probably shouldn't be spoken by anyone. Anyway, I'm gonna wait until 1.13 before I try this. Thanks for the suggestions!