First thing is that OSI model is a reference and theoretical model which breaks down the functionality in different layers although the real implementation of network might differ.
It is better to have abstractions over abstractions. It is good to have multiple layers with different functions rather than a monolithic implementation. If every layer would have its own concern then it will be easy to find the root cause of failure if it occurs.
Also a network for e.g. Internet is a very complex structure which requires different protocols to actually implement it. If the headers would be constructed all at once then it will not be distinguishable how the protocols are actually applied. A protocol which applies to the physical medium (e.g. Ethernet protocol) cannot be applied before actually producing reasonable and transmittable chunks of the data (which is done at an upper layer).
So it is a good practice to do it progressively and this generally applies to entire Computer Science because it is never recommended to have one monolithic chunk rather than multiple small understandable chunks.