I like Jerry Seinfeld’s take on plagiarism in comedy. His point is that whoever writes the funniest joke about a given premise gets the credit. This applies forward as well. As you may come up with a new angle and punchline for a well established premise.
I wrote a fun (to me) take on the good ‘ole horse walks into a bar joke. Here it goes:
But you have to steal something, themes at least if you want to create a piece in a style.
Trying composing a blues song without any "stealing".