### 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.
virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {}
	virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override {}
	
	virtual RID decal_instance_create(RID p_decal) override { return RID(); }
	virtual void decal_instance_free(RID p_decal_instance) override {}
	virtual void decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) override {}
	virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) override {}
	
	static GLuint system_fbo;
	RenderTarget *get_render_target(RID p_rid) { return render_target_owner.get_or_null(p_rid); };
	bool owns_render_target(RID p_rid) { return render_target_owner.owns(p_rid); };
	void copy_scene_to_backbuffer(RenderTarget *rt, const bool uses_screen_texture, const bool uses_depth_texture);
	virtual RID render_target_create() override;
	virtual void render_target_free(RID p_rid) override;
	virtual void render_target_set_position(RID p_render_target, int p_x, int p_y) override;
	virtual Point2i render_target_get_position(RID p_render_target) const override;
	virtual void render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) override;
	virtual Size2i render_target_get_size(RID p_render_target) const override;
	virtual void render_target_set_transparent(RID p_render_target, bool p_is_transparent) override;
	virtual bool render_target_get_transparent(RID p_render_target) const override;
	virtual void render_target_set_direct_to_screen(RID p_render_target, bool p_direct_to_screen) override;
	virtual bool render_target_get_direct_to_screen(RID p_render_target) const override;
	virtual bool render_target_was_used(RID p_render_target) const override;
	void render_target_clear_used(RID p_render_target);
	virtual void render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) override;
	virtual RS::ViewportMSAA render_target_get_msaa(RID p_render_target) const override;
	
	void render_target_set_as_unused(RID p_render_target) override {