I believe John kind of stands alone, Matthew was written first, and Mark and Luke were based on both Matthew and - get this - an unknown source material referred to as "Q".
Thanks for the explanation of why certain books were rejected, I wasn't aware of that particular test. I'm not the one who equated "Q" with the Gospel of Thomas but did bring up Q. As I understand it, Q may have been referenced very early on as a source for the other books, but all copies are lost to history. They only theorize about it because there is so much alike in the two books that cannot be attributed to Matthew, so it is theorized that another form of the Gospel existed early on before things began to coalesce. I could be misremembering but thought it was kinda spooky cool about it being called Q.