Was X17 predicted before it was observed?

Is the X17 predicted, or discovered? It depends upon what the meaning of the word "is", is.

Prediction vs. Discovery

In particle physics, phrases like "the Higgs boson" or "dark matter" actually stand in for mechanisms or effects, which could be realized in many different concrete models. And even when you specify a model, it's still ambiguous because you can vary how "fundamental" your model is.

The Higgs boson itself is a good example of this. Before the LHC, we knew for sure that particles in the Standard Model had mass, that this was difficult to accommodate the standard way (by adding so-called "mass terms" to the Lagrangian), and that a very simple and elegant way to do it was the Higgs mechanism. By calling it a mechanism, we mean that it required only general ingredients, such as spontaneous symmetry breaking and new bosons, but that it wasn't specified how the symmetries were broken or what new bosons were added.

What we call "the" Higgs boson is just the simplest set of ingredients you could supply to get the Higgs mechanism to function. There were many alternatives, such as the two-Higgs-doublet model, which would give you five Higgs bosons instead.

And even once you fix "the" Higgs boson, you could go deeper. In the resulting model, the mass of the Higgs boson is put in by hand, and basic consistency requirements only fix it within a rather wide range. You could consider more complex models that predict more specific values of the mass, or even explain where the Higgs boson itself comes from, e.g. if it falls out of an elegant grand unified model or is itself made of other particles, like the proton is made of quarks. There were so many of these theories that just about any Higgs mass in the reasonable range could be accommodated by one or ten.

So I would say it's fairly clear that a Higgs boson was predicted before discovery... but it's completely up for debate whether a Higgs boson of mass $125$ GeV was predicted or discovered!

Fifth forces

Like "dark matter" or "the Higgs boson", "the fifth force" is another one of those vague phrases that really stands for thousands of distinct models -- basically any model that consists of the Standard Model and any new gauge bosons. Fifth forces are interesting because they are extremely simple extensions of the Standard Model (e.g. you could just take one of the existing forces and exactly copy it), and many more complex/fundamental models give you them automatically. Another appealing feature is that many types of fifth forces give rise to striking experimental signatures, which we can look for with great sensitivity.

So in that sense, a fifth force has been predicted for a long time. However, because of the avalanche of possible distinct fifth force models, experimentalists usually don't try to test specific models. Instead, they parametrize the effects of the fifth force in terms of a few quantities (the mass of the gauge boson, the gauge coupling, the coupling to electrons, the mixing with the photon, etc.). Then they run tests that try to capture as much of this parameter space as possible. Many such tests have been performed in the past and are ongoing now.

The experimentalists behind the X17 boson were looking for a specific type of fifth force, called a "dark photon". These are part of a relatively new mechanism to produce dark matter (DM), using an entire "dark sector" where the DM only affects normal matter through the dark photon. This mechanism has been gaining in popularity because it results in lighter DM, and the traditional heavy DM has been pretty conclusively tested by WIMP searches. However, "dark photons" are still not a specific model, but rather stand for a general idea that has a range of corresponding concrete models, and within each one the mass of the dark photon can lie in a wide range. So they were inspired by these theoretical ideas to look for MeV-scale bosons, but not directed to any specific mass; they just were trying to capture as big a slice of parameter space as possible.

They indeed found evidence for a new MeV-scale boson, but it behaved in a rather strange way. In a later theory paper, it was explained that the boson could not have been a dark photon, as a dark photon with that mass and coupling would have already been discovered in earlier experiments. Dumping the dark photon interpretation, the theorists showed that the observations could be accommodated, without conflict with earlier experiments, if the new boson had the unusual property of being "protophobic", i.e. not coupling to protons. The experimentalists then did a follow-up work confirming their results, leading to the recent media frenzy, and that's where we are now.

I hope it's apparent that your question does not have a yes or no answer! Fifth forces have been thought about for a long time, but they're a very general thing. The experimentalists were motivated to look by a recent, particular kind of fifth force (dark photons) -- but what they saw wasn't compatible with it. Science often progresses this way.

Addendum

I realize the discovery isn't official yet but some articles suggest pretty good certainty that the observation is legit.

This needs to be said: I don't think any practicing particle physicist would give this observation more than a 5% chance of holding up. At any moment, there are about 50 distinct experimental anomalies, each of which could revolutionize physics if true. Historically, the vast majority don't pan out. That's because physics is subtle, experimental physics is even more subtle, and these measurements are often pushing the limits of what our equipment can do. (There is the further problem that the lab claiming the X17 has a history of reporting similar anomalies -- if I recall correctly, they already pulled this exact same thing twice in the past, with different boson masses, and never explained why those observations went away.)

It just so happens that you've heard more about this anomaly because it blew up in the media. This happens naturally: the more prominent a story gets, the more each journalist wants to write their own take on it, and so you automatically get a winner-take-all situation where X17 gets more attention than the next ten most recent anomalies combined.

I wouldn't recommend worrying about the X17. Science will go on, the experiments will be thoroughly scrutinized and replicated, and in ten years' time we'll know for sure if it's real or not. If it is, you'll hear about it everywhere. If you hear nothing, assume it disappeared.