Yeah. How long I can work depends on how crappy the work is. This could also explain why CEOs and similar are happy to spend long hours at job… they probably have way more power over their working conditions than I do. Pretty sure they have a room where they can close the door for a moment.
Sounds like you’re describing autonomy, mastery, and meaning—some of the big factors that are supposed to influence job satisfaction. 80,000 Hours has an old but nice summary here https://80000hours.org/articles/job-satisfaction-research. I expect job satisfaction and the resulting motivation make a huge difference on hours you can work productively.
With motivation, focusing on your work is easy. Without motivation, you burn your self-discipline, and then you give up.
So, without motivation it becomes a question of how many hours worth of self-discipline you have, or rather how many you can pretend you have. With motivation, it is only a question of what else do you also need to do during the day.