Rules as Written (RAW), Monks ignore gravity only when the rules say they do
There's no question that a monk's relationship with gravity is peculiar. They have the ability to run on water, up walls, or even to literally "slow fall" (at 9th and 4th level respectively). So it's reasonable to ask to what extent this "fast and loose" relationship with a fundamental force of the universe applies.
The simple answer is, gravity works differently for monks when the rules say it does. If you wish to make an argument that a vertical jump is considered horizontal for monks when they have just been running up a vertical surface, you need to find a rule that says this is the case. Unfortunately, there isn't one.
Note that the rules for jumping specify that you need to have "move at least 10 feet on foot" (PHB, p. 182) to jump as high or far as possible: but it doesn't specify that this movement has to be horizontal. So at least a monk could gain this benefit from running up a wall, that other classes might not be able to use (since it's debatable whether or not climbing counts as moving "on foot").
"Rule of cool", you might be able to talk a DM into it.
There's no question that the thought of a monk running up a building and then launching themselves "sideways" upward is incredibly cool. Just for the visuals alone, you might be able to talk a DM into it. But since your question was about how to determine if "the rules" apply, the simple answer is that rules apply when the rules say they do.
...But either way, the monk could still reach the flying enemy!
In your hypothetical, the monk will have only used up 20 feet of movement by the time they reach the top of the building (and are presumably standing on it), and have a speed of at least 35 feet (as a 9th+ level monk). At that point, they could use their Step of the Wind which gives the following benefits (PHB, p. 78):
You can spend 1 ki point to take the Disengage or Dash action as a bonus action on your turn, and your jump distance is doubled for the turn.
The rules for jumping vertically state (PHB, p. 182):
When you make a high jump, you leap into the air a number of feet equal to 3 + your Strength modifier if you move at least 10 feet on foot immediately before the jump...You can extend your arms half your height above yourself during the jump. Thus, you can reach above you a distance equal to the height of the jump plus 11/2 times your height.
You stated that this monk has a strength of "at least 10", which means their Step of the Wind ability will let them jump 6 feet up. Let's assume a worst case scenario, and presume that this monk is a halfling. A halfling PC has a height of 2' 7'' + 2d4 inches (PHB, p. 121). So at least they are 2' 9''. This would mean that they could then jump and reach the following height:
$$ (2+(9/12))*1.5 + 6 = 10.125 feet$$
So your hypothetical monk could still reach the enemy 10 feet above the rooftop using the usual rules for jumping vertically!