This is the conclusion of Naomi Novik's Scholomance series. In the first two, El gets to realize she's not alone, she's connected. She realizes she needs help and that when she works with others, she can do more than she can alone. Her school learns the same. Massive battles are fought, huge sacrifices are made. El has grown powerful and early on was offered a place in an Enclave - which used to be her childhood goal. In the world of the Scholomance wizards are delicious to monsters. That's why they don't just rule everything. There are two ways to get the power for a spell - a hard way and an easy way. The easy way is.. dark. And that darkness makes monsters. And those monsters love to eat wizards. Wizard children are especially delicious - that's what drives the creation of a school for wizard children where it's considered acceptable that merely most of each class dies. So, of course the dark way is considered awful and no one would do it. But it is easy. And just a little bit of it when you really need it can be excused.
In the same terrible logic that drove the bleak stories of The Tangled Lands, we find that there sure are a lot of monsters out there. And the worst monsters are the ones called "maw mouths". If you are eaten by one, you never fully die, you just merge and are digested forever and are used by the maw mouth. They are incredibly difficult to kill. El has learned how to kill them, but there is a horrible price, and not just that it's painful to kill them.
In this world, an Enclave is a place of refuge. It's a hideout where powerful wizards can take refuge and protect each other from the stream of hungry monsters that sniff out wizards. They cost a lot to make and maintain and less fortunate wizards strive and scrape and bow and serve to either gain admittance or get their children in to the relative safety. They councils of the Enclaves around the world are incredibly powerful and the economics are tragic. And that's not all. There's an even darker cost at the center of it all, a true Omelas that El is forced to make choices about.
Our hero does well. She has learned to work with others, to take care of them, and others have put their hearts in her as well - even if she is the crankiest person on Earth. Faced again with a terrible system and a brutal dilemma she does what she was born to do. She refuses to be shunted into a stupid trolly problem and figures out a pure cooperative play. The final end of this is a decent place to stop, and it all comes together so smoothly it seems like Naomi Novik had a plan all along - no idea if that's true!
The series is a fun read - I blasted through these like they were Halloween candy and I love it when my hero brings everyone together.