I've worked those kinds of jobs with 12 hour shifts pretty recently, and you definitely Really Actually Literally Work 10+ hours of em'. It's kind of a buzz.
I could still do it, 6 days a week, day-in day-out at 32, which was pleasantly surprising to me as someone who has always struggled to work a good 4 actual hours of white collar shift.
Some jobs just come at you non-stop, and basically your only options are quit dramatically, or keep grinding through.
The camaraderie with your work colleagues is something too. I've never felt that kind of genuine, manic, expendables-in-the-trenches, darkly comic camaraderie in any white collar job.
I couldn't keep my brain continually engaged in SE for even what would be a short 'shift' - but I reckon I could still do the >12h full days I did at the cinema as a teenager (plenty to do even while all screens are showing).
Meetings, administrative tasks, emails, chat messages, more meeting requests, for most people the default setup has all of this coming at them like a firehose, and then bizarre expectations build and build like sedimentary rock into this seabed of constant immediate response times and work without productivity, a feeling of working with nothing at the end to justify it.
in a 40-50hr work week I would say 50-60% is productive actual work (i.e writing a program, or doing the actual task you are paid to do), 10-15% is administrative (making task list, organizing your work, reporting about your work, etc) 10-15% is meetings about your work, 10-15% is socialization with co-workers, unofficial breaks, informal meetings, etc.
So if you do not count the other time as "productive" which I could and would challenge then that 4hr number holds true.
Secondly, we do work for more than 4 hours a day. In fact, I work in my sleep. The brain doesn't just shut off. The reason you can't just "keep going" at the keyboard for more than 4 hours is your hands are faster than your brain. But the brain doesn't stop. It keeps crunching away. Every morning I find myself with new insights and new ideas that I didn't have the day before. I'm not just being paid for the hours I spend bashing away at the keyboard, I'm being paid to engage my brain with the business.
So using school as a for instance. If it takes me 12 hours of studying a week to ensure an A, but only 2 hours a week to ensure a B, is the additional 10 hours wasted studying really worth it? Nope. Much rather make my life more enjoyable.
What they meant of course was not whether they could be "at the job(site)" for more than 4 hours a day, but that you could only really do actual (productive) work for 4 hours a day. The rest, so my friend claimed, is almost always filler. My friend also claimed that they believed this was true almost regardless of the type of work you did. Even people doing physical labor don't actually "work hard" for much more than 4 hours - you need breaks (lots of little ones, or maybe a few long ones).
I still don't know if they're right about this. Personally, I've always preferred the maxim about "work long, hard or smart: pick 2". Either way, I know that across society, not just in IT related fields, we do not honor these ideas about work in any meaningful way.