### Godot version

4.1.stable

### System information

Windows 10 22H2 - GLES3 - GTX 1080 Ti (driver 536.40)

### Issue description

I noticed this bug in the code while debugging #79315, and confirmed the issue with testing. If you take a material using a filtering mode that has anisotropic filtering (eg `RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC` aka "Linear Mipmap Anisotropic") and switch it to a filtering mode that doesn't have anisotropic filtering (eg `RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS` aka "Linear Mipmap"), the anisotropic filtering remains enabled for the texture until it gets reloaded (eg by reloading the scene). I've only tested this in the editor, but this should also apply to games themselves if they change the filtering mode of a texture through code. This issue doesn't occur with the Mobile renderer (and I assume the Forward+ renderer).



### Steps to reproduce

1. View a surface with a material with anisotropic filtering disabled at an angle that you can tell it's disabled.
![no anisotropic](https://github.com/godotengine/godot/assets/607715/4c3f2c68-6284-412c-9adf-625f4c3e2ab6)

2. Switch the filtering mode of the material to one with anisotropic filtering enabled.
![with anisotropic](https://github.com/godotengine/godot/assets/607715/b67e5bb5-68f8-4934-bf0f-35836666724e)

3. Switch the filtering mode of the material back to a mode with anisotropic filtering disabled, and note how the surface still has anisotropic filtering applied.
![bug anisotropic](https://github.com/godotengine/godot/assets/607715/05037b2e-be9f-4351-8a77-b9b73c832696)


### Minimal reproduction project

I used the texture repeat test program from #79315 for the example pictures, so I'll use that as the minimum reproduction: [RepTest.zip](https://github.com/godotengine/godot/files/12011701/RepTest.zip). Just make sure to rotate the camera for the test, as the default position in that project isn't in a good spot for testing anisotropic filtering.
render_target_clear_used(p_render_target);
	}
	void render_target_request_clear(RID p_render_target, const Color &p_clear_color) override;
	bool render_target_is_clear_requested(RID p_render_target) override;
	Color render_target_get_clear_request_color(RID p_render_target) override;
	void render_target_disable_clear_request(RID p_render_target) override;
	void render_target_do_clear_request(RID p_render_target) override;
	virtual void render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) override;
	virtual Rect2i render_target_get_sdf_rect(RID p_render_target) const override;
	GLuint render_target_get_sdf_texture(RID p_render_target);
	GLuint render_target_get_sdf_framebuffer(RID p_render_target);
	void render_target_sdf_process(RID p_render_target);
	virtual void render_target_mark_sdf_enabled(RID p_render_target, bool p_enabled) override;
	bool render_target_is_sdf_enabled(RID p_render_target) const;
	void render_target_copy_to_back_buffer(RID p_render_target, const Rect2i &p_region, bool p_gen_mipmaps);
	void render_target_clear_back_buffer(RID p_render_target, const Rect2i &p_region, const Color &p_color);
	void render_target_gen_back_buffer_mipmaps(RID p_render_target, const Rect2i &p_region);
	virtual void render_target_set_vrs_mode(RID p_render_target, RS::ViewportVRSMode p_mode) override {}
	virtual RS::ViewportVRSMode render_target_get_vrs_mode(RID p_render_target) const override { return RS::VIEWPORT_VRS_DISABLED; }
	virtual void render_target_set_vrs_texture(RID p_render_target, RID p_texture) override {}
	virtual RID render_target_get_vrs_texture(RID p_render_target) const override { return RID(); }
	virtual void render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) override;
	virtual RID render_target_get_override_color(RID p_render_target) const override;
	virtual RID render_target_get_override_depth(RID p_render_target) const override;
	virtual RID render_target_get_override_velocity(RID p_render_target) const override;
	virtual RID render_target_get_texture(RID p_render_target) override;
	void bind_framebuffer(GLuint framebuffer) {