I've found that immersion alone doesn't work for me either. I've lived with roommates from China who spoke primarily Mandarin, and despite spending a lot of time with them, trying my best to learn, and them being very patient, I never got anywhere. I was also going to a university in Germany where students could enroll in German-language engineering programs with only limited proof of German proficiency. A lot of the less-experienced German speakers ended up just hitting their heads against the wall and not learning anything (about German or their field), even though they had significant pressure to pass their classes.
In my experience, most people need both some explanation of the fundamentals of grammar/pronunciation (formal education) combined with opportunities to use the language (immersion is perfect for this, but you can practice on your own as well). Figuring out what differences in Mandarin pronunciation are essential for meaning (tone) vs. which ones are meaningless, for example, is very difficult to do from immersion alone.
It's possible for the formal education to be in the target language, but if so it has to be very carefully designed. In my experience Duolingo does a somewhat decent job at the formal education part, but is more helpful if you had some formal education in a language, so you know what variations to look out for.
It sounds like you already had quite a lot of formal education before you had a chance to do immersion. Glad it worked for you!
Duolingo has been very effective for me, not because it's perfect, but because it's something I can actually do, while moving to a Spanish-speaking country or getting a job at a restaurant run by Spanish-speakers is not. Could I learn faster? In theory, but in practice it's the only strategy I've been able to stick with and I still am making progress. It's given me the foundation to practice using the language in other ways.
Language learning also requires you to actually be invested in the learning. I don't think any learning method works if you are totally passive. You have to be trying new things. You don't have to necessarily put yourself in a situation where you need to use the language. I've seen plenty of homesick people studying abroad who really need to learn the local language, but resent it, and end up sitting around learning nothing. But you do have to want to use the language. My German teacher was great at this. German had no practical applications where I studied, but we would play games, make jokes, and generally toy around with the language, which helped us push the boundaries of our language knowledge.