In your discussions with the school, make sure you ask them what they would do for a student who was returning from a surgery or cancer treatment. I found there was an inherent bias and less flexibility with missing school for residential mental health care vs. intensive physical health care.
We were in this situation as well. Ultimately, school took a very different path than we expected. DC started at a very flexible, small private school, but we ended up leaving there and doing some homeschooling, online classes, unschooling, Fusion, and eventually dual enrollment community college classes for high school. Heading down that path was out of my comfort zone but it was what my DC needed.
I wish you and your DC the best of luck. You’re doing a great job focusing on getting them the help they need. There are many ways through the school part.