How to avoid race for two `cmake --build` in parallel?

No, this is not supported. Though ninja might perform some locking making these effectively serial, there is no guarantee CMake provides itself.