### Godot version

Godot 4 stable and Godot 3.x LTS

### System information

Fedora linux

### Issue description

If you use some custom logic inside _integrate_forces() to alter the state linear velocity and there is any reference to linear_velocity in physics process, the result in godot 3.5 is that it moves just a little bit, while in godot 4 is totally still.

### Steps to reproduce

For the example i created a simple scene in which i apply a force on the linear velocity in  _integrate_forces()  and added a line that add zero to it in physics process. You will not see any move, but it will work fine if you comment the line adding zero.


### Minimal reproduction project

[PhysicsBugReproduction.zip](https://github.com/godotengine/godot/files/12139772/PhysicsBugReproduction.zip)

ClassDB::bind_method(D_METHOD("move_and_slide"), &CharacterBody2D::move_and_slide);
	ClassDB::bind_method(D_METHOD("apply__snap"), &CharacterBody2D::apply__snap);
	ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &CharacterBody2D::set_velocity);
	ClassDB::bind_method(D_METHOD("get_velocity"), &CharacterBody2D::get_velocity);
	ClassDB::bind_method(D_METHOD("set_safe_margin", "margin"), &CharacterBody2D::set_safe_margin);
	ClassDB::bind_method(D_METHOD("get_safe_margin"), &CharacterBody2D::get_safe_margin);
	ClassDB::bind_method(D_METHOD("is__stop_on_slope_enabled"), &CharacterBody2D::is__stop_on_slope_enabled);
	ClassDB::bind_method(D_METHOD("set__stop_on_slope_enabled", "enabled"), &CharacterBody2D::set__stop_on_slope_enabled);
	ClassDB::bind_method(D_METHOD("set__constant_speed_enabled", "enabled"), &CharacterBody2D::set__constant_speed_enabled);
	ClassDB::bind_method(D_METHOD("is__constant_speed_enabled"), &CharacterBody2D::is__constant_speed_enabled);
	ClassDB::bind_method(D_METHOD("set__block_on_wall_enabled", "enabled"), &CharacterBody2D::set__block_on_wall_enabled);
	ClassDB::bind_method(D_METHOD("is__block_on_wall_enabled"), &CharacterBody2D::is__block_on_wall_enabled);
	ClassDB::bind_method(D_METHOD("set_slide_on__enabled", "enabled"), &CharacterBody2D::set_slide_on__enabled);
	ClassDB::bind_method(D_METHOD("is_slide_on__enabled"), &CharacterBody2D::is_slide_on__enabled);
	ClassDB::bind_method(D_METHOD("set_platform__layers", "exclude_layer"), &CharacterBody2D::set_platform__layers);
	ClassDB::bind_method(D_METHOD("get_platform__layers"), &CharacterBody2D::get_platform__layers);
	ClassDB::bind_method(D_METHOD("set_platform_wall_layers", "exclude_layer"), &CharacterBody2D::set_platform_wall_layers);
	ClassDB::bind_method(D_METHOD("get_platform_wall_layers"), &CharacterBody2D::get_platform_wall_layers);
	ClassDB::bind_method(D_METHOD("get_max_slides"), &CharacterBody2D::get_max_slides);
	ClassDB::bind_method(D_METHOD("set_max_slides", "max_slides"), &CharacterBody2D::set_max_slides);
	ClassDB::bind_method(D_METHOD("get__max_angle"), &CharacterBody2D::get__max_angle);
	ClassDB::bind_method(D_METHOD("set__max_angle", "radians"), &CharacterBody2D::set__max_angle);
	ClassDB::bind_method(D_METHOD("get__snap_length"), &CharacterBody2D::get__snap_length);
	ClassDB::bind_method(D_METHOD("set__snap_length", "_snap_length"), &CharacterBody2D::set__snap_length);