This is probably an off-topic question, but I clearly remember asking the same question some 25 years ago in university when we discussed TCP/IP in networking 101.
The 2 answers I got then and which still makes sense where:
"At the time TCP/IP v4 was designed it was far from certain there wouldn't be an extension to IPv4 in the future that would make it more useful. So they left this in as an opening to future changes."
"If the software processing the TCP-IP packets has no knowledge of the L2 aspects of the data-transfer if needs a method to find the size. Either you put it in the packet or you provide a separate argument to the software that specifies the length. So you just might as well put it in the header in the first place."
(To illustrate the last: You mention this yourself in the question: "The total length of the data passed from the link layer" is the addiitonal argument.)