Causing enemies to slide around walls

Hi, I’m making a tower defense game where you can build walls. I would like it if enemies collided with a wall they would then try to slide down the wall to get around it. Unfortunately, I haven’t been having any luck or many ideas. I’m using

        rigid.MovePosition(Vector3.MoveTowards(transform.position, SelectedTarget.position, speed * Time.deltaTime));

for the movement. I originally had the idea that I could make it so when the character hits a wall, they turn to the side and walk forwards until they aren’t touching the wall anymore, but that lasted about until I realized it only worked with specific wall angles and not in general (here was my code for that):

void Update()
{
    if (noWall)
        rigid.MovePosition(Vector3.MoveTowards(transform.position, SelectedTarget.position, speed * Time.deltaTime));
    if (!noWall)
    {
        rigid.MovePosition(transform.position + transform.up * Time.deltaTime * speed);
    }
}

private void OnTriggerEnter(Collider other)
{

    if (other.tag == "Wall")
    {
        Quaternion deltaRotation = Quaternion.Euler(new Vector3(0, 0, 90));
        rigid.MoveRotation(transform.rotation * deltaRotation);
        noWall = false;
    }
}

So I guess I have two questions. Is there a simple way for me to evolve this code into something that will work no matter the wall rotation (keeping in mind that the enemy is not approaching from the same angle all the time), and if not, does anyone have a suggestion on how to accomplish this (code example appreciated but unnecessary)?

Why not use navigation mesh so that your agents will avoid obstacles like walls?