Sometimes this is not completely wrong.

I never used Curl or looked at the source code, I don't know about the specifics, but rewriting a simpler copycat from scratch is not always a bad idea.

I've done that a few times, to prove a point or because the original was bad and too difficult to maintain.

This reminds me of bocker. (https://github.com/p8952/bocker) A minimal docker in 100 lines of bash.