The actual meaning of a "clean room implementation" is that it is derived from an API and not from an implementation
I know you were simplifying, and not to take away from your well-made broader point, but an API-derived implementation can still result in problems, as in Google vs Oracle [1]. The Supreme Court found in favor of Google (6-2) along "fair use" lines, but the case dodged setting any precedent on the nature of API copyrightability. I'm unaware if future cases have set any precedent yet, but it just came to mind.
[1]: https://en.wikipedia.org/wiki/Google_LLC_v._Oracle_America,_....
Yeah, a cleanroom re-write, or even "just" a copy of the API spec is something to raise as a defense during a trial (along with all other evidence), it's not a categorical exemption from the law.
Also, I find it important that here the API is really minimal (compared to the Java std lib), the real value of the library is in the internal detection logic.
This is exactly what I had in mind when I said I was simplifying :) it is a valid point.