When it comes for the gray goo, there are more reasons it would not consume entire systems, aside real-world-physics.
One of the barriers defends our Universe from gray goo goes apocalypse - gray goo existence and it's nature. Perfect replication - is a fairy tale because of mistakes that is inevitable because of numerous factors, starting from quantum level. So each next generation of nano-machines will be slight different, and even if they managed to continue self-replicating due to built-in self-adjustments mechanisms - sooner or later one thing happen: gray goo will give birth to sub-species that will use mother-gray-goo as a material. Numerous iterations later you going to have either goo eats itself or extremely complex gray goo ecosystem. First is more likely, second wild create something really wonderful and almost for sure smart and self-aware, and what ever it be, or how dangerous, it will no longer be a gray goo anymore.
BTW any civilization, able to create gray goo is also able to create gray goo virus, that will spread faster and stops when there are no food.