Conceptually, 2 IDs are like 2 people. If she logs out of ID2, it won't delete the messages in my Messages app, so I doubt it would do so in hers. However, the wrinkle here is perhaps a shared phone number/email address. If that's the case, that's like being 2 people and 1 person at the same time.
For extra security, she could export all messages to PDF files and save them as a permanent record that way. A bonus to that is that she could then PURGE all these messages and likely free up enormous space.
IMO: the very best way to use Messages is just like we use the Phone: call-communicate-hangup... which translates to start a text, text, close text. Next time we want to chat with that person, call or start a new text with them then. It's become a thing to maintain forever text history when so much of them are usually a bunch of stuff about nothing that will never be reviewed again. However, if there is SOMETHING in some messages that might matter for legal or similar claims, a render to PDF is a great way to unload messages but keep all history.
Once she has them all as PDF history, she can just try logging out of ID2 and into ID1 and seeing what happens. If she then logs back into ID2 and they are all there, she could- conceptually- jettison the PDF files and carry on as normal. OR again, just jettison all of the old messages and start new texts like initiating a new phone call. That will free up huge iCloud space and keep the resource needs of Messages small & lean at all time.