### 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)

Vector2 motion = velocity * p_delta;
	Vector2 motion_slide_up = motion.slide(up_direction);
	Vector2 prev__normal = _normal;
	platform_rid = RID();
	platform_object_id = ObjectID();
	_normal = Vector2();
	platform_velocity = Vector2();
	
	
	bool sliding_enabled = !_stop_on_slope;
	
	bool can_apply_constant_speed = sliding_enabled;
	
	bool apply__velocity = false;
	bool first_slide = true;
	bool vel_dir_facing_up = velocity.dot(up_direction) > 0;
	Vector2 last_travel;
	for (int iteration = 0; iteration < max_slides; ++iteration) {
		PhysicsServer2D::MotionParameters parameters(get_global_transform(), motion, margin);
		parameters.recovery_as_collision = true; 
		Vector2 prev_position = parameters.from.columns[2];
		PhysicsServer2D::MotionResult result;
		bool collided = move_and_collide(parameters, result, false, !sliding_enabled);
		last_motion = result.travel;
		if (collided) {
			motion_results.push_back(result);
			_set_collision_direction(result);
			
			if (on_ && result.collider_velocity != Vector2() && result.collider_velocity.dot(up_direction) < 0) {