If we a sequence of 5 heads or 5 tails was unlikely, and given a strategy to wait for a sequence of 4 (e.g., 4H), and then bet on the opposite outcome on the 5th flip (e.g., T), is this a flawed strategy and why?
The strategy you suggest is a poor prediction strategy that is rooted in the gambler's fallacy. It is generally based on the notion that coin flips must "even out" over some finite time horizon, and so after a long run of one outcome, the other outcome is "due". This is a misunderstanding of the statistical law-of-large-numbers.
Luckily for you, the problem of predicting coin tosses falls within the subject of binary prediction, which has been studied extensively in probability and statistics. Coin tosses can reasonably be regarded as an exchangeable sequence of binary outcomes, and in the special case where you have a fair coin (i.e., the long-run proportion of head and tails in the sequence are equal), the tosses are then independent with equal probability of heads or tails on each flip. In this case the chances of a tail are no higher after a run of heads than at any other time and so your prediction strategy is no better (or worse) than any other prediction method.
In the more general case where the coin might be unfair (i.e., it might have different long-run proportions of heads and tails), the outcomes are generally positively correlated (see O'Neill 2012). It turns out that betting on an outcome because it has not come up very often is the worst possible strategy in these cases. In the event that the coin is biased towards one of the faces, the observed outcomes of flips will give you information on the direction of the bias. Using a Bayesian analysis, O'Neill and Puza (2005) have proved that if there is some non-zero probability of bias in the coin, and the direction of bias is unknown,$^\dagger$ then the posterior probability of an outcome is higher for the outcome that has already been observed the most. This implies that the optimal prediction method is to choose the outcome that has been observed most (the frequent-outcome approach). Later papers on this topic have proven that the probability of correct prediction under this prediction method converges to the maximum of the proportions of the different outcomes (see O'Neill 2012), which is the probability of correct prediction that would prevail if you were able to make predictions with perfect knowledge of the level of bias in the coin.
So, in summary, betting on an outcome because it has come up less often than the other outcome is the worst possible strategy under reasonably assumptions about the random mechanism. By choosing the outcome that has come up least, you are choosing the outcome that is most likely to have bias against it, if the coin happens to be biased. In the long-run this strategy will perform worse than every other non-equivalent strategy.
$^\dagger$ Represented as a symmetric prior density for the true long-run proportion of heads/tails.