Can only be done one way and has been done - not novel; you can only think of one way to do it and don't know if it has done that way or at all, may be is patentable.
From one example it is hard to give a general answer that might apply to a case you might actually be thinking about.
One can not get a patent on something that is not novel or is obvious (using U.S. patent law concepts) or not useful.
Novelty is judged by trying to find a single reference, published before the filing date, that contains all elements of the claimed invention. An examiner can't just say "that is the way I would have solved the problem" or "everybody knows that already". This is to make the test for novelty more objective and give the applicant something tangible to argue against.
Next consider obviousness. The examiner can't just say "seems obvious to me". Besides the problem that it is far from objective, there is a strong psychological effect called "hindsight bias". Once you know a solution, it seems obvious even if you would never have come up with it independently.
To assert a rejection based on obviousness an examiner needs to find one or more references that, together, have all the elements in a claimed invention. That part is pretty objective. Then they need to argue that a (fictitious) person of ordinary skill in the art would think to combine those references to achieve the claimed invention. A POSITA knows everything that was ever published anywhere at any time in any language in the relevant field or specifically relevant to the problem from an other field and is of median/average skill in the field.
There are rare cases where the problem was never recognized and the recognition of the problem is an important part of the invention. In that case the solution might be obvious once the problem was (inventively) identified. That would still not be an obvious invention. Your example might fit into this.
In the rest-of-the-world obviousness is replaced by "having an inventive step", not exactly the same concept. And the rules of what can be considered prior art different.
A third criteria is "useful" in the U.S. It is somewhat analogous to "industrial applicability" in the rest of the world. Until about 2000 this was a trivial hurdle in the U.S. As long it was not a law of nature (abstract), something completely done in your head or a perpetual motion machine, it was probably useful.
There have been many rulings since then that have put more and more things in the "abstract" category and if it's abstract its not useful. This is the basis of the "you can't patent software" mantra. There are plenty of things that look like software that get patented but it is getting harder.