I've been working on a browser on and off for a few years, I just started adding js support via Fabrice Bellard's Quickjs project and did this on my Pinephone while taking the train. I use FVWM as the DE with xvkbd as the keyboard (Originally I was expecting to have to change that but it turns out typing fast isn't needed to stay focused as long as you're decent at vim.)
I've tried coding on iOS before but the whole thing is really built to push you toward chatting and scrolling. Everything is miserable down to switching between your editor and browser, copying files, and running your build tools. Not to mention the feeling that you can't build your own tools to fix problems you have.
It's totally possible to be productive on a phone but you need to not be fighting against the OS vendor to do it.