As soon as your job involves thought work, there is rarely any connection whatsoever between where the job is done and productivity. For example, in software development it's common that NOT writing code right now is the best choice if you haven't done the other steps. For jobs like this, productivity is a cycle that involves first learning, then planning, then finally maybe writing some code. Or maybe learning some more first and then continuing to plan.
Planning is by far the most important piece, and it can be done literally anywhere and even while performing another task as long as it isn't a mentally-demanding one. So, at least in my experience you literally cannot plan while coding. Not anymore than you could write a novel. But you can do it while lifting weights, going for a jog, eating lunch, sleeping, taking a shower etc. etc.
Where's the most comfortable place to plan? It's okay for that to be answered differently by different people. For some people that's the office. For many more people it's sitting at home in pajamas or whatever.