When a Necrozma-Dusk or a Necrozma-Dawn has been sent out and is evolving into Ultra Necrozma out of a battle, you can use lunarizer or solarizer to separate Necrozma and Solgaleo/Lunala to get them all exist.
For example, use lunarizer to a Necrozma-Dawn when it is evolving into Ultra Necrozma out of a battle can separate the Necrozma-Dawn to a normal Necrozma and a Lunala. Then the normal Necrozma will still evolve into Ultra Necrozma. When you withdraw it, it'll turn to the Necrozma-Dawn rather than a normal Necrozma. This issue makes it possible to have Necrozma-Dusk and Lunala at the same time.
I've seen this ticket:
https://www.pixelmonmod.com/tracker.php?p=2&t=14317 , This issue is kind of like mine.
There're branches of issues about this, hope that your guys can solve it breezily :)