Well there's the rub - once you see the source code, it's tough to say you weren't influenced by it. In for-profit endeavors this kind of thing is typically done by having two separate groups of people, one that sees the competing product and writes detailed descriptions of behavior, and one that never sees the product, only the product of the first group. If you're careful about this and go to pains to keep the groups strictly separated, you're in the clear. If you've read the source code and go and write very similar source code, you're considered tainted from an intellectual property perspective. It doesn't prove you copied them, but you certainly lose a lot of moral high ground. In this case, I doubt many of the copyright owners are going to care, let alone actually pursue legal action. But seeing the source code is legally dangerous at times. I am not a lawyer.
We're talking copyright here, not patents. If I read copyrighted C code, and rewrite it in Rust, I don't think a copyright claim can touch you, no matter how similar they are.
Note well: IANAL. This is my understanding of copyright law, not legal advice.
IANAL also. But it's important to distinguish a copy (which is just more or less copying what you read in C) vs a derivative work (a work that could not have been done or would have been done noticeably differently in the absence of the parent work existing). Just because you read Harry Potter 5 years ago and only now bother to write a fanfic in French using your memory of that world as a base, maybe keeping most names or subtly changing them a bit, does not mean your new work isn't derivative. It probably shouldn't be derivative given how much of our creative culture is remix upon remix, but hey, that's a much more extreme position that gets close to abolishing copyright entirely.
Code is just tricky though and metaphors for books and other things often break down easily... API / module substitution copyright seems silly, but maybe only to people who understand programming or who can grasp the metaphor that copyrighting an interface is like saying any book that uses numbered chapters (instead of custom named chapters) is a derivative work of the first book that used numbered chapters. Some code "could be but one way", naming included / irrelevant (I think a lot of SO code is like this, there are very few ways to glue together certain bits of code to do small thing X in context C), some of it is more like performance art, some of it is just almost pure math, and some of it works as a whole to solve one particularly hard problem which in itself has business value, just as music has business value by solving the problem of being appealing to listen to so that people buy it. Copyright law seems ill-equipped to handle it. Strategically though, I'd go with what the lawyers advise -- a lawsuit that I win can still be more costly than just playing it safe to begin with.
> you're considered tainted from an intellectual property perspective.
No you're not. The law has exactly zero to say about this. The idea of "clean room" development is nothing more than a legal tactic used to ward off potential lawsuits from an aggressive adversary. It's in no way necessary to do this.