There is a block above you while you are fishing? if there is, break it.
its a good idea to take your items with mending out of your inventory, except for the rod.
Also, make sure your mouse is not aimed at the string or something like that.
That is everything i can think at, i never had this problem
EDIT: aim exactly at the sweet spot, hold right-click and while you hold it unplug the mouse (plug it before on the front ports so its easier to unplug) before going afk. This way, the mouse will continue right-clicking on the correct spot, and not move away. you can even unplug the mouse and it will continue clicking, but if overnight your mouse somehow move out of the spot, your farm will not function correctly.
i have a 'house' that i made for afk fishing and when my fishing rod broke while i was asleep and i always unplug my mouse while using the afk fishing mechanics.
it has happened to me only once, and i feel like the reason why it broke was because my chests were all full. i added 3 more double chests and after that my fishing rods have been fine and stuff, so that's my theory anyway.
I have built a whole bunch of AFK fish farms in the last 6 months on vanilla java/PC minecraft, and I have seen lots of fishing rods disappear like this. It happens every time your storage fills up. This is why I always make sure to have more storage than needed. On single player I usually setup 8 double chests connected by hoppers. On a server where I've been playing, the performance isn't as good, and I rarely need that many. However, when you're first starting out, losing that one mending/lure3/luck3 rod can really slow you down.
This is my current setup:
1) Isolate your fishing setup. One mob will kill you and your rod will despawn. Seems obvious, buy I've had somebody in multiplayer open a door and then left me to die. I'm sure one slime cube could do the same thing.
2) Put EVERYTHING, including your armor, in a chest before fishing AFK. You should only be risking your rod, nothing else. Yes, I woke up to find all of my equipment in a chest, my rod missing, and then...all my enchanted diamond armor gone that I forgot to take off. Ouch. Don't be this guy.
3) Make sure and have way too much storage. You can reuse those chests and hoppers later on if you want, but it's not worth the risk of running out and losing your rod.
I have seen this happen enough times to myself that I am certain this is the problem if you notice that your storage is full and rod is missing after a long AFK session. I don't know WHY you don't get xp/mending, but I know it happens every time the storage fills up, without exception (a couple times I caught it with all full chests, items floating on top of the water, and my rod nearly broken).