To science your way into the Institute, you need to have someone help you
create the molecular relay. This can be either the Brotherhood, the Railroad, or the Minutemen.
This step requires you to side with a major faction, but your allegiance can still be changed.
To finish the main story line,
you need to either side with the Institute and destroy the hostile factions, or side with one of the other three factions to destroy the Institute.
There is no other way to end the faction war. You could continue playing the game as long as you like without doing this, but you would never "finish" it.
Once you do finish it with one of the factions, the game is permanently changed, and the faction war ends.
More information can be found in the answers to Is there a point of no return in Fallout 4?.