Tldr: I now have a phone that works when it is plugged in but continuously reboots when it is not, shows the Oneplus logo and then reboots again. I am able to boot into TWRP or fastboot. I tried a wipe clean and flash Lineage 15.1 but still the same issue. Occasionally it gets a few seconds into the OS boot process, I start to see the lineage OS boot sequence and then it crashes again.
I had Lineage 15.1 on the phone, which I believe was flashed over 14.1 without a wipe (i dont remember). It was quite unstable, it used to crash and reboot couple times a day. And this particular time, it rebooted, then crashed again, and started the bootloop that it is in now. It was getting faster.. Initially it used to reboot to the lock screen, then crash in a second or 2. Then it used to come to the boot animation and then crash, and soon after just looping at the manufacturing logo. I did not flash or do any such tinkering recently. Yesterday, before I wiped, It was stable as long as it was plugged in to power, and then when I remove the power cable the boot loop would start. Now after I tried the wipe there is no such thing any more. It reboots whether it is connected or not. The only thing I did differently was use a cheap aliexpress cable that i bought recently and a old powerbank for a few minutes the day earlier, and given the behavior with it bootlooping on battery but not on AC, i was wondering if the battery pack or the cable fried my battery in some way.
Edit: Even after flashing a new rom I have the same behavior, works if it is plugged in, bootloop on battery.