I was having a problem similar to this, and it was very chaotic. One of my contacts got messed up where iOS would inexplicably send messages sometimes over iMessage to their email account (which it wasn't supposed to do), sometimes over RCS to their phone number (which it was supposed to do), and then sometimes over SMS, presumably when RCS would fail.
Then when I removed the email from their contact in the hopes that it would stick to RCS, but instead it divided up the messages into multiple chats, as though the email were still sometimes linked to the contact, but sometimes not. Sometimes my texts would go through, sometimes not. Sometimes I'd receive their text messages, sometimes not. Sometimes there'd be this phantom chat, or just an entire duplicate of certain parts of the conversation. Sometimes the incoming texts would appear as though they were also being sent to the email as well, even though that is definitely not the case.
I tried restarting my phone, deleting the phantom chats, deleting their contact all together, updating my phone software, but to no avail. I have my texts ported over to my MacBook and my iPad as well, and these problems existed over there too. Finally I reset my network settings, and thus far it seems to be working.
I have no idea what triggered this to happen. In the meantime I'm not adding their email to their contact in case that has something to do with it. None of this ever happened before updating to iOS 18.x and starting to text with RCS.
I know others were saying that it could be a carrier problem, not an iOS problem, but based upon my observations here and my limited understanding of RCS, I'd be more inclined to think that this was and iOS problem. Especially considering the phantom messages and the fact that now that it's fixed, my iPad conversation appears normal (the only device I didn't delete my conversation history on). But what do I know?