It’s pretty simple. More investment to build more robust and more connected lines. High traffic lines could be multiple rails wide, so faster passenger trains (which are time sensitive) can pass slower freight trains.
The issue with our rail infrastructure is that lines have been reduced over and over. Also, despite legally amtrak being given priority, they rarely do get it. Freight trains are often too long to be able to let them pass, so they are no longer legally required to get out of the way, because there isn’t an alternative for them.
Freight causes issues with the current system, but it is not required to cause issues. It only causes issues because we have chosen to not invest in improving things.