...
As already discussed in the previous threads ad nauseum, yes, that exists, but it's nowhere near capable of generating enough energy to be put into the ecosystem for licking caustic slime off of rocks to plausibly sustain a small city, much less the biodiversity of the cavern system.
...
I was more arguing for how magical lifeforms would process material in a way that could translate to agriculture, since it is a given that they're using some nonsensical energy source, it doesn't matter if the real mechanic is low-energy or not.
...We've got the energy source figured out, but there is still the matter of nutrients and moisture to discuss for cavern plants.
I was actually focused on answering this part; it's a deep, dark cavity in solid rock, assuming energy is limitless for sessile organisms, how would a pioneer organism look and function? I went with chemotrophs because it solved three problems with subterranean life, they could make material-food out of what the barren underground has to offer, they could widen the caverns by transmuting solid rock into potentially breathable gasses. It wouldn't matter so much if it were high-fantasy, but since there's a scale to work with I figure this would be fine for low-medium fantasy.
...
That sounds good, but why isn't that common in real life if that works?
As noted by NW_Kohaku, chemosynthesis is low-energy and can't carry an ecosystem as well as phototropism can so they get out-competed anywhere sunlight is an option.