It’s essential to consider living with roommates as a temporary arrangement, as you never know what will happen with them. They might decide to move in with their boyfriend on a whim three months into the lease, forcing you to find a subletter as soon as possible. They might have a major, tragic event happen in their family, which means they won’t be renewing their lease for the following year. Or they could stop paying their rent on a whim, forcing you, the person whose name is also on the lease, to find a solution to a problem you didn’t create.
If a roommate has a significant life circumstance that necessitates a move, that’s their cross to bear. What they can’t do is request that their roommate leave the apartment before the lease is up, because they want to stay in it and want their roommate to go. Roommates can’t control where you live.