Do we know it’s not a factory bike? I don’t think this is an electrical problem. It seems more biochemical.I am sorry, but I don't understand what you write. At all.
I suggest it would be better if you bought ready made e-bike to avoid all this stress.
Asif it matters Shimano steps e6000