What quests do you need to stop at before you make an enemy of a faction for each faction?

  • Mass Fusion (/ Spoils of War)

    Institute vs. Brotherhood of Steel

    Upon entering the relay, one should get a warning that relaying to the Mass Fusion building will make them a permanent enemy to the Brotherhood of Steel. Continue and the player character will be teleported to the Mass Fusion executive suite.

    Alternatively, by informing the Brotherhood, Spoils of War will start, and boarding the Vertibird that spawns on the Prydwen will make the Institute hostile.
    source

    Once this mission has started, make your (first) save (see image below)!

  • End of the Line

    Institute vs. Railroad

    The player can choose to either warn or kill Desdemona.
    source

  • Blind Betrayal

    Brotherhood of Steel vs. Railroad

    As mentioned on the page for the quest Tactical Thinking:

    If the player is not ready to close off activities with the Railroad, avoid turning in [Blind Betrayal] for now.
    source

  • The Battle of Bunker Hill

    Institute vs. Railroad

    Wrong dialogue choices [in the conversation the player has with Father during the mission debriefing], such as admitting it was the player character's fault, can lead to being banished from the Institute.
    source


The infographic below shows how to get as many trophies/achievements in one walkthrough, and thus notes the points at which to make a save game:

Fallout 4 main questline overview in regards to the separate factions
source unknown