Firming up your tests, logging, observability, and debugging practices really does help here.
The only time I enter a desperate fugue state juggling too many disparate code modules in my head is when the system is a poorly factored enterprise monolith.
Those aren’t uncommon but I reflexively avoid jobs that make those the majority of my work.