No, you can't let bare cable rub over an aluminum or carbon frame. In the history of steel frames there have been many frame parts and designs made that do allow rub (see many 70s and earlier lugged BB shells for example), but that's a tangent.
The picture makes it appear possible that if you move the BB cable guide into its other mounting hole, the problem might go away. If not, the cable guide isn't really right for the frame, or something else is missing.
Unless your frame has a proprietary guide made for it that you also can get your hands on, you should replace it with one of the generic ones that support the cable as it runs up between the stays. Here for example is a picture of a set of 3 available on Amazon; the one you would use is the far left.
It's common for bikes with the type of routing showing in the first picture (an upwards-pointing exit for the cable) to have proprietary routing pieces or cable guides that fit up inside. It looks like something might have been lost here at some point.
Cable liner (which can be bought on its own or taken from a shift housing) can be used to mitigate rub in some circumstances. In the right application using it is appropriate or even by design. Here it looks like the cable is wanting to rub over an irregular surface, which is a clue that something else is wrong and liner isn't really a solution.