### Godot version

4.0.1(flatpak)

### System information

Linux openSUSE

### Issue description

Cyclic Dependencies in shader result in infinite loop

### Steps to reproduce

Create 'main' shader that includes other shader, let's say `inc_me1` and `inc_me2` if 'inc_me1' that includes 'main' shader and 'inc_me2' includes 'inc_me1'. It results in a freeze.

### Minimal reproduction project

[Shader dependency.zip](https://github.com/godotengine/godot/files/11547654/Shader.dependency.zip)
uncomment include, and the editor will freeze and crash
const int line = p_tokenizer->get_line();
	int nesting = 0;
	while (true) {
		p_tokenizer->advance('#');
		String id = p_tokenizer->peek_identifier();
		if (id.is_empty()) {
			break;
		}
		if (nesting == 0) {
			for (int i = 0; i < p_directives.size(); i++) {
				if (p_directives[i] == id) {
					p_tokenizer->backtrack('#');
					return id;
				}
			}
		}
		if (id == "ifdef" || id == "ifndef" || id == "if") {
			nesting++;
		} else if (id == "endif") {
			nesting--;
		}
	}
	set_error(RTR("Can't find matching branch directive."), line);
	return "";
}
void ShaderPreprocessor::add_to_output(const String &p_str) {