One of the foundations of most farming is that given a large are, you can just place the plants and care for the ground they're on, and handle pests that can be seen. That's manageable with lots of farm labor and with available building material. Building a glass louvre around every rural farm between the tropics of cancer and capricorn, replacing the wind and rain, etc is just not how rural third world farming works.
If coffee, globally, needed to be grown in greenhouses it would just become a novelty tree that school trips visited until the climate turned around and it became an economically viable crop again.
Unaffordable coffee is essentially equivalent to no coffee for 98% of the population.
Check out this video to get a sense of what goes into producing the beans we all consume. https://www.youtube.com/watch?v=BCCILcuWChM