Extracted from #14265.
This situation needs to be tested and dealt with:
- Dependency Foo depends on Dependency Bar, which runs Bar's build.zig.
- Dependency Bar depends on Dependency Foo, which runs Foo's build.zig.
- Infinite loop occurs.
This would not be an issue when depending on zig packages without executing build.zig logic (#14282).
Marking as "bug" because I'm pretty sure this will be an infinite loop, when instead it should be a nice error message.
The user is supposed to avoid this problem by putting their call to dependency() inside an if statement to break the loop.