i noticed that the autoeat is simulating a right click which doesn't behave correctly when the food is your off hand, if you're holding a block or any item that has a right click interaction in your main hand the game prioritizes the main hand first so it starts spamming blocks or using the item in your hand
my proposed fix is using the minecraft.gameMode.useItem which takes an InteractionHand parameter, but i dont know if this would be an issue with anti cheats? maybe it could be an option in the settings
also if you change slots after it starts eating from the off hand it switches back to the slot that was selected when it started eating