Calling it a "mistake" vs just a lack of knowledge is a weird way of framing it. There was much discussion of "junk DNA" (now referred to as non-coding DNA) for years/decades - everyone realized it was an anomaly to be explained, but no-one knew the explanation. This comprises the vast majority (98%) of DNA - so clearly it was there for some reason.