This limitation with merging is inherent to any format which tries to represent 2D or 3D data. Text or binary, the file is always one dimensional. It’s not about optimizing the file format. I mention this in Pros and cons of using a VCS (git etc.) with KiCad and it’s explained with examples in Tools for cooperation?.