I've encountered a bug where if you get a union between 2 nations the selected nations origin gets changed to a random one.
In the 2 unions i've had both times it changed the origin to a random one, but it got changed to the same random one for both of them.