### Godot version

9f9210e60cddb2fa82ce5f7d71fcba340f2edbd1

### System information

Windows 11

### Issue description

I found that one of particles shaders in my project begin working incorrectly after the recent fixes. I've bisected it to 9f9210e60cddb2fa82ce5f7d71fcba340f2edbd1.

Before:
![image](https://github.com/godotengine/godot/assets/3036176/556bb0ed-6214-42ce-b194-8b54b0349b18)


After:
![image](https://github.com/godotengine/godot/assets/3036176/b3fa0b8a-20a6-4c5a-aea7-3e1ec465ea3e)


### Steps to reproduce

Download the provided test project and compare changes with different version.

### Minimal reproduction project

[bug.zip](https://github.com/godotengine/godot/files/12476303/bug.zip)

ClassDB::bind_method(D_METHOD("set_gradient", "gradient"), &GradientTexture1D::set_gradient);
	ClassDB::bind_method(D_METHOD("get_gradient"), &GradientTexture1D::get_gradient);
	ClassDB::bind_method(D_METHOD("set_width", "width"), &GradientTexture1D::set_width);
	
	ClassDB::bind_method(D_METHOD("set_use_hdr", "enabled"), &GradientTexture1D::set_use_hdr);
	ClassDB::bind_method(D_METHOD("is_using_hdr"), &GradientTexture1D::is_using_hdr);
	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "Gradient", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT), "set_gradient", "get_gradient");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,16384,suffix:px"), "set_width", "get_width");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_hdr"), "set_use_hdr", "is_using_hdr");
}
void GradientTexture1D::set_gradient(Ref<Gradient> p_gradient) {
	if (p_gradient == gradient) {
		return;
	}
	if (gradient.is_valid()) {
		gradient->disconnect_changed(callable_mp(this, &GradientTexture1D::_update));
	}
	gradient = p_gradient;
	if (gradient.is_valid()) {
		gradient->connect_changed(callable_mp(this, &GradientTexture1D::_update));
	}
	_queue_update();
	emit_changed();
}
Ref<Gradient> GradientTexture1D::get_gradient() const {
	return gradient;
}
void GradientTexture1D::_queue_update() {