Newton's first law provides a guide: "Every object persists in its state of rest or uniform motion in a straight line unless it is compelled to change that state by forces impressed on it."
So, the definition of a force as something that causes an object to change its movement from a "straight line" comes to us from Newton's laws.
> Why does the existence of a transformation that makes movement under a supposed force actually follow a straight line mean it's not really a force?
It's not just the fact that the transformation exists that means we don't really consider gravity to be a force. It's that the transformation exists, and provides useful predictions about the universe that turn out to be backed by experiment.
Under the theory of general relativity gravity isn't a force, because the fundamental premises of general relativity assume that gravity is actually a distortion of spacetime caused by mass.
We say that "gravity" isn't a force simply because the predictions made by general relativity have been validated by a number of experimental observations—at least on the macro scale.
> For the other forces (e.g. electromagnetism) can we say that there's _no way_ to exhibit a transformation that causes charged particles travel on "straight" lines?
I'm certainly not an expert, so I can't really comment on this. My best guess is that there doesn't exist any such transformation that causes charged particles to travel on "straight" lines that makes experimental predictions as well as our current scientific theories.