Good question. I think that you are right that a pedestrian injury is more likely than getting attacked by someone (yea, most likely a guy) but assault is a possibility that can not be dismissed.
I’m a guy, sometimes hike solo, and try to be non-threatening. I’m so sorry that this is even an issue. But it is.
My guess is that you are safest in populated places where there are other people or in very remote places that only sincere explorers make it to. But camping out you may not have much control over being around others or being alone.
Carrying a weapon is probably a deterrent. Guns come with political baggage and the statement is “I could kill you” but I don’t really blame women for wanting to make that statement. If you are not a gun person, a big knife might work.
An emergency signaling device, like an InReach, may be a deterrent. It is not an immediate deterrent but it does mean that you have thought through what you are doing, people know where you are, and people will come looking.
The first time I solo backpacked I was nervous about everything unknown. I think this is a common experience. Time and experience this everything going well will help calm your nerves. With time, an no incident, you feel more comfortable.
I also recognize that may not work when your fear is that someone will assault you. That is something you have no control over. I’m thinking of the PCT and one fear is mountain lions - a predator that is out there any may decide to assault me. I don’t know when and have no control.