OnTriggerEnter2D and OnTriggerExit2D not being called after finding multiple triggers

I have a problem where when my character runs into a corner of walls (therefore finding 2 triggers) it doesn’t call the OnTriggerEnter when I only leave one wall. So in basic terms:

  1. The character runs into a wall on the left, and is stopped from going left, but can still move up/down/right
  2. The character goes down the wall while still touching the wall on the left
  3. The character runs into the bottom left corner of the wall, and is stopped from going left and down
  4. Problem: The character than goes up while still being on the wall to the left, but now is not detected as touching the wall on the left, and now can move through the wall.
    here is my code (Sorry for it being messy):
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

public class rigidmove : MonoBehaviour
{
public bool abletomove = true;
public bool abletomoveL = true;
public bool abletomoveR = true;
public bool abletomoveUp = true;
public bool abletomoveDw = true;
public bool Rbox = false;
public bool Lbox = false;
public bool Dwbox = false;
public bool Upbox = false;
public bool BottomL = false;
public bool BottomR = false;
public bool UpperL = false;
public bool UpperR = false;

public bool diagonal = false;
public int distance = 5;
public int numofCol = 0;
// Start is called before the first frame update
void Start()
{
    Rigidbody2D rbdy = gameObject.GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{

    if (abletomove == true)
    {
        Rigidbody2D rbdy = gameObject.GetComponent<Rigidbody2D>();
        if (Input.GetKey(KeyCode.D) && abletomoveR == true)
        {
            rbdy.transform.Translate(distance * Time.deltaTime, 0, 0);

        }

        if (Input.GetKey(KeyCode.A) && abletomoveL == true)
        {
            rbdy.transform.Translate(-distance * Time.deltaTime, 0, 0);

        }

        if (Input.GetKey(KeyCode.W) && abletomoveUp == true)
        {
            rbdy.transform.Translate(0, distance * Time.deltaTime, 0);

        }

        if (Input.GetKey(KeyCode.S) && abletomoveDw == true)
        {
            rbdy.transform.Translate(0, -distance * Time.deltaTime, 0);

        }

    }

    if (Rbox == true && Dwbox == true)
    {
        BottomR = true;
        print("I'm in the bottom Right");
        abletomoveL = true;
        abletomoveUp = true;
        abletomoveR = false;
        abletomoveDw = false;
    }

    if (Lbox == true && Dwbox == true)
    {
        BottomL = true;
        print("I'm in the bottom Left");
        abletomoveL = false;
        abletomoveUp = true;
        abletomoveR = true;
        abletomoveDw = false;
    }

    if (Rbox == true && Upbox == true)
    {
        UpperR = true;
        print("I'm in the top Right");
        abletomoveL = true;
        abletomoveUp = false;
        abletomoveR = false;
        abletomoveDw = true;
    }

    if (Lbox == true && Upbox == true)
    {
        UpperL = true;
        print("I'm in the top left");
        abletomoveL = false;
        abletomoveUp = false;
        abletomoveR = true;
        abletomoveDw = true;
    }

    if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.D))
    {

        diagonal = true;

    }
    else { diagonal = false; }

}



private void OnTriggerEnter2D(Collider2D collision)
{
    numofCol += 1;
    if (diagonal == true)
    {
        print("diagonal entrance");

    }

    if (Input.GetKey(KeyCode.A))
    {
        Lbox = true;
        abletomoveL = false;
        abletomoveR = true;
        abletomoveUp = true;
        abletomoveDw = true;
        print("A is Pressed");
    }

    if (Input.GetKey(KeyCode.W))
    {
        Upbox = true;
        abletomoveL = true;
        abletomoveR = true;
        abletomoveUp = false;
        abletomoveDw = true;
        print("W is Pressed");
    }

    if (Input.GetKey(KeyCode.D))
    {
        Rbox = true;
        abletomoveL = true;
        abletomoveR = false;
        abletomoveUp = true;
        abletomoveDw = true;
        print("D is Pressed");
        
    }

    if (Input.GetKey(KeyCode.S))
    {
        Dwbox = true;
        abletomoveL = true;
        abletomoveR = true;
        abletomoveUp = true;
        abletomoveDw = false;
        print("S is Pressed");
    }

    Rigidbody2D rbdy = gameObject.GetComponent<Rigidbody2D>();
    print("enter");
    
    
}

private void OnTriggerExit2D(Collider2D collision)
{
    
    Rigidbody2D rbdy = gameObject.GetComponent<Rigidbody2D>();
    abletomoveL = true;
    abletomoveR = true;
    abletomoveUp = true;
    abletomoveDw = true;
    Rbox = false;
    Dwbox = false;
    Lbox = false;
    Upbox = false;
    BottomL = false;
    BottomR = false;
    UpperL = false;
    UpperR = false;
    numofCol -= 1;
    print("exit");
    
    
    
}

}

P.S. If someone can also fix the fact that entering walls diagonally lets me go through them that would be great, but I would much rather have this fixed first.

I was able to fix this for the most part by adding if statements with the numofCol value to check if the character ran into a single wall or two in the ontriggerexit function and the update function.