You need a way to remove sediment from the sea floor and move it to the roof of the cave
As far as I can tell the biggest problem here is keeping the floor clean. All life in the ecosystem is going to produce some sort of waste that will fall to the floor.
This also means that nutrients will over time migrate from the cave ceiling, and organisms would evolve to make use of the nutrients on the lit floor and break them down into a fine sediment, so essentially soil. Very quickly the sea floor would become completely covered, and even if you were to make the surface ridged, the valleys would quickly overflow with sediment.
On top of that, the trees wouldn’t have any reason to be trees and grow tall if they aren’t competing for sunlight. This will naturally create a canopy as tall as they can possibly can grow, meaning that the ocean floor would be covered in a dense canopy.
So what we need is someway to move the sediment from the sea floor to the rocks above, and to make it difficult to for life to exist on the sea floor.
My first thought that wouldn’t fit your needs super well is just some sort of hand wavium powered paddle that sweeps the dirt away every ten years or so and deposits it in a cavern in the ceiling, to prevent it from falling back down where the trees can get to it. This will always work so long as the machinery is working and sufficient caverns can be dug.
Another solution I had is a biologically engineered bottom feeder that lives on the sea floor, and very quickly gobbles up the sediment and grows fat. It’d preferably have no anus and instead a large bladder that collects it’s waste. You could Also have them just obsessively eat their own feces and have an extremely slow digestive system.
I picture this as an army of shrimp like creatures and living on the sea floor, with a sucker mouth looking that have have a ever growing butt, similar to honeypot ant. Then once it reaches the maximum weight it can transport to the ceiling, it’d crawl up the rock walls in your diagram to the roof. To us this would look incredibly strange but to the inhabitants of this world it’s just be a natural part of the ecosystem like migrating birds. The organism would need to be extremely effective and also stay on the floor it’s entire life. 87
It could even be so effective that any plants growing to close to the floor would be immediately eaten
It’d have a very quick life cycle that ends with the creature flying or crawling to the roof of the cave, burrowing deep into the rock, reproducing and then immediately dying. Then, once born the offspring would immediately burrow out and fall to the ground.
Biggest issue with this guys would be preventing evolution. Over time natural selection would lead to these creatures simply staying on the sea floor and gaining a more efficient digestive system. Even if their reproduction was asexual and produced perfect and they had a crazy effective immune system that prevents all disease, mutations would still arise after enough time
The only real solution I could think of to prevent this adding some sort of technological solution to this. Perhaps each one of them contains a some sort of robotic core that independently prints an embroyo, another robotic core, and a encases this in an egg.
This certainly isn’t the most elegant solution and turns them into robots essentially. They’d also need to get enough metal/silicon/unobtonium throughout their life cycle to make more robotic cores. Maybe add another organism living on the roof, smelting the metal and dropping it the sea floor.
Another solution would be to to make them immortal, and have insane regenerative tissue. Instead of dying on the ceiling they’d just fly up to bury their poop. This probably wouldn’t last as long as if you stick one of them into a blender, they’d have to either die or each little bit of tissue would regenerate, and could possibly lead to mutations arising from the separate clumps. Maybe some combination of the two would work.
Another possibility for an engineered organism would be a tree like creature that produces a large hallow trunk leading to the sea floor, and it would produce some sort of suction and vacume to the sediment to the cave ceiling.
Bottom line though, the only evolution would lead to the floor being covered pretty quickly. If not tree leaves or algae than dirt.
Creating a engineered crature would likely fit the medieval setting better than a machine, but a handwavium mechanism would likely last a lot longer but might look strange in this setting 1008