This takes practice.
When words are flowing, leg fatigue shouldn’t cut a writing session short. When I’m “wired in”, I don’t want to have to think about the discomfort in my lower back. I just want to think about my work.
I have a sit-stand desk: http://jakeseliger.com/2015/01/24/geekdesk-max-sit-stand-des.... Best of both worlds! When I'm in the zone I often get up, walk a little, and then continue working anyway. Putting it from sitting to standing or vice versa doesn't disrupt flow, at least for me.