I'm busy scanning this thread for a solution for my problem which is exactly like yours. I'm also experiencing very slow charging times when on the wall charger. For some reason it charges as normal when plugged into my PC (change USB configuration to MTP mode in developer options). I also believe it to be a software problem - I've already replaced the charging ribbon cable (inside), the battery, USB cable and wall charger with no effect. Then I did a factory reset of my tablet and it worked for a little while, but then the problem came back. Another factory reset and it worked again for a little while before the problem re-appeared. I'm going to try another factory reset and then not installing any apps. Then one by one I'll install apps to see if something messes up the charging. Maybe it's Magisk that affects it? Although I doubt it.
I am, however, almost certain it's a kernel issue, but I have no idea how to prove that or where to start tinkering.
I also tried the OS14 ROM but found it a bit buggy. Maybe I'll have to revert to that one if I can't get this charging issue sorted.
i finally managed to solve my problem but i fear that my solution won´t work for you. My charging device was simply broken. I wrote that i used the original wall charger and the original USB cable. I bought myself a cheap NoName charging device for 10€ at amazon just to give it a try because of several people saying that this solved their problems. And it worked for me too. With this charger the charging time is about 4-5 hours which is okay, i think.
But if your tablet charges normally for a short amount of time once you resetted it, the problem should be somewhere else. Especially if you tried several wall chargers and cables. I hope someone else will have a good advice that you will get this managed eventually.
By the way: I´m currently running CM 13 on my tablet and it works great. No performance or battery drain issues.