Rap music did that years ago.
Remember when MC Hammer lifted the riff from Rick James' SUper Freak of U can't touch this? James was all ready to sue until he discovered his old music was all of a sudden getting sales again. That made it all OK.
Sampling synths did recorded samples which you could then program together. That is also old.
Twenty years ago I got a sample program for Acid. That was a looping software from SOnic FOundry. You could cut and paste musical phrases, not unlike ProTools. You could buy Acid sample libraries. OMG, apparently it is still around. These are specific licks and phrases.
NO reason you couldn't adapt that.
I used to see the Ensoniq guy do a demo of their sampler keyboard. He came to our store once a year. He'd blow in a coke bottle and sample the WHOOT. Then he'd use that as a tone, which would expand up and down the octaves and make up some composition. He also took a selection of presampled licks and put together a bar or two of music, which he then repeated to make a song. That was 25 years ago.