How to correct move the player on the platform?

Hello. Tell me how to correct move the player on the platform. The platform moves from left to right and back.
I watched all the videos on YouTube, I’ve been working with Unity for a year and I can’t do this basic mechanic.

My player and platform have a rigid body. The player has it dynamically on the kinematic platform.
Here is the code for moving the player

void FixedUpdate()
{
playerRigidbody2D.velocity = new Vector2((horizontalInput * playerRunSpeed) + playerRigidbody2DAddVelocityXValue, playerRigidbody2D.velocity.y + playerRigidbody2DAddVelocityYValue);
}

Here is the code for moving the platform

public float platformSpeed = 1f;
    public Vector2 leftPointPosition;
    public Vector2 rightPointPosition;

    private Rigidbody2D rb;
    private bool movingRight = true;
    private GameObject player;
    private PlayerController playerController;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        player = GameObject.Find("Player");
        playerController = player.GetComponent<PlayerController>();
    }

    void FixedUpdate()
    {
        float moveDirection = movingRight ? 1f : -1f;
        rb.velocity = new Vector2(moveDirection * platformSpeed, rb.velocity.y);

        if (movingRight && rb.position.x >= rightPointPosition.x) movingRight = false;
        else if (!movingRight && rb.position.x <= leftPointPosition.x) movingRight = true;
    }


    private void OnCollisionStay2D(Collision2D collision)
    {
        playerController.PlayerRigidbody2DAddVelocityXValue = rb.velocity.x;
        playerController.PlayerRigidbody2DAddVelocityYValue = rb.velocity.y;
    }

    private void OnCollisionExit2D(Collision2D collision)
    {
        playerController.PlayerRigidbody2DAddVelocityXValue = 0;
        playerController.PlayerRigidbody2DAddVelocityYValue = 0;   
    }

When the player steps onto the platform the additional speed of the platform (PlayerRigidbody2DAddVelocityXValue) is added to his speed and player moves with platform.
When the player leaves the platform, this additional speed is reset to zero.

And everything seems to be working. But when the platform changes direction, the player moves towards the previous direction of movement of the platform (as if he is being carried along by inertia).

How to fix it?

PS
Making the player part of the platform is useless. My movement is based on velocity, not on transform.
And the velocity is calculated globally, i.e. you still need to increase the velocity of the platform.