Below I'll argue that transitioning to a diet produced without sunlight (via vertical farming as well as labs and, eventually, food synthesizers) has several major benefits that I feel are underappreciated. As this will require colossal amounts of power, a rapid transition away from farming is likely only advantageous after the widespread construction of clean energy and carbon capture infrastructure; however, I feel that greater resources should be directed towards developing new food production technologies immediately.
1) Potential to restore vast amounts of natural habitat:
According to the UN FAO, roughly 38% of Earth's surface area is used for agriculture; perhaps more relevantly--as, for example, deserts host relatively little life for either animals as a whole or farmers--over half of the planet's habitable land mass is reserved for human food production. A scenario where vertical farming produces plant food, labs supply synthetic meat, and, perhaps, primitive food synthesizers provide some simple foods with high value like milk, it might be possible to almost double the amount of natural habitat available for non-human life (and, to some extend, human life as well).
2) Protection from WMDs:
Our dependence on sunlight may render us vulnerable to a near extinction event via nuclear winter. It's beyond my knowledge how likely it is that billions of people would die from starvation due specifically to nuclear winter (both due to its plausibility and its relevance if almost everyone would be more directly killed by nukes anyways in a nuclear winter scenario); however, from what I gather, it's a reasonable enough risk to give at least some weight to.
Filtered air entering these facilities could protect against chemical (defoliants and otherwise) and biological attacks. (There is a counterpoint that concentrating a nation's food supply, at least if done to an extreme extent, makes it easier to significantly destroy with explosives.)
3) Greater food supply reliability:
As the variables with indoor production are largely optimized and controlled while conventional farming is subject to extreme weather, societies should benefit from much more predictable food output; this would not only offer enhanced food security and lower price volatility but also--everything else being equal--result in lower prices as labor force efficiency is enhanced by not needing to frequently shift practices to meet the challenges of supply constrictions and excesses.
Additionally, as growing seasons are shorter (and able to be planned without regard to nature), indoor farming could more rapidly rectify shortages during the era where both indoor and conventional farming are substantially practiced.
4) Expedited space colonization:
Even a largely or highly terraformed planet may have difficulty growing certain Earth crops (eg due to low gravity or loss to indigenous subterranean peoples) and highly developed indoor food production technology may accelerate life's ability to multiple throughout the universe.
I believe this also slightly lowers our chance of extinction; however--as I see AI as the only bona fide extinction threat before we are capable of space colonization and I'm skeptical that becoming multiplanetary will save us from hostile superintelligent AI--I suspect our survival hinges more on education and appreciated mutual interests rather than rapid space colonization or technological solutions in general.