Hi, having the same problem (wheatfarm with farmers and rails underneath). My solution: breed a new farmer villager (inventory has to be empty!). Fill his/her inventory with 7 stacks beetroot and 1 stack wheat seeds. (you can fill more than 4 slots with the same product now) Make sure they cannot trade with any other villagers. I am running a test now and so far it is working.
You will get wheat and bonemeal from this farm.
Wondering: if I fill one slot with bonemeal, one slot with wheat seeds and 6 slots with beetroots de farmer can use the bonemeal to make the wheat grow faster. This will be my next test.