To manage big pipelines, I would also suggest to use the Aggregation pipeline builder either in MongoDB Compass or directly in MongoDB Atlas if this is an option here.
I then abuse the import / export to code options to manipulate them. It works very well for me.
I think the new Shell (still in beta for now), Mongosh is also trying to solve some of these issues.
Cheers,
Maxime.