FreeBSD, NetBSD and OpenBSD at first when every BSD OS was just part of 386BSD it used to have AT&T code. That code was rewritten replacing every propietary part and after that (and noticing BSD 4.4 was incomplete) we got clean FreeBSD, NetBSD and OpenBSD from a NetBSD fork.
Another similar case with exact grounds was GNU which with Linux it completed an OS albeit in a hacky way, because the original OS would have been GNU+Hurd, but both are reimplementing Unix. Same SH derived shell, but extended. Kinda like OpenTTD. We have GNU Coreutils, Findutils, GNU AWK reimplementing and extending AWK (even when AWK was propietary), GNU Zip, Tar... the list goes on and on.
Oh, another one: Lesstif vs Motif. Same UI, if not very, very close to Motif 1.2 in order to be interoperable. Today it doesn't matter because nearly a decade a go Motif was relicensed into the GPL, but tons of libre software depending on propietary Motif was just seamlessly running with LessTIF libraries except for some rough edges/bugs. One of the most known example was DDD, a GUI for GDB.