There's no supporting theory, because this doesn't work except by chance alone.
Your choice of null and alternative hypotheses depend only on what you're trying to prove and not the sample value. Suppose you have some new drug that's supposed to lower cholesterol, and you want to test if it works. The null hypotheses is that the drug increases cholesterol or has no effect, while the alternative is that the drug actually does lower cholesterol. To claim that the drug does lower cholesterol, you need a significant amount of data to support that, typically enough to have an alpha of 0.05 - only 1 time in 20 will you say the drug has the intended effect when it actually does not.
If you flip your hypotheses arbitrarily, you're implicitly assuming that the drug works as intended, and requiring significant evidence to show that it does not. But that's not how proof works - a new claim requires positive evidence, you don't just assume it's true and then look for evidence it's false (which you could always fail to find just by collecting little evidence). Failing to show that the drug doesn't work as intended might just be a failure of your sample size, but is not alone evidence that it does work as expected. If you collect only 3 patients' worth of data, you won't have enough evidence to reject the possibility that the drug works as intended, but that's not meaningful at all. You should view that data as showing that you don't have evidence to conclude that the drug works, not that you've failed to rule out the drug's efficacy.
As you can see, none of this line of reasoning requires you to know anything at all about the cholesterol values actually observed in the population. How you test whether the drug works should not depend on whether the drug actually does work or not. The only reason this worked in your exams is because you got lucky defining the null and alternative hypotheses as your instructor intended (you had a 50/50 chance each time). The sample value has absolutely no role in defining the directionality of the hypothesis test.