Destroy self on collision with other instantiated GameObject

I attached a script(called wallscript) to a Prefab called Wall, that checks whether it is colliding with another GameObject, and then destroys itself, as it shouldn’t be there if it collides with that GO. The gameobjects are instantiated by another script, mazegenerator script. I cannot get the wallScript to destroy itself, and i still end up with overlapping GameObjects

Here Are my Scripts:
WallScript:

using UnityEngine;

public class WallScript : MonoBehaviour
{
    void OnTriggerEnter(Collision collision)
    {
        // Check if the colliding object has a specific tag (you can customize this)
        if (collision.collider.gameObject.CompareTag("Wall"))
        {
            // Destroy the other GameObject
            Destroy(collision.collider.gameObject);
        }
    }
}

MazeGenerator:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MazeGenerator : MonoBehaviour
{
    // Variables    
    // Public
    public GameObject Wall;
    public float MazeSize = 50f;
    public float NumberOfWalls = 500f;
    // Private
    private int Rotation;
    
    
    void Start()
    {
        GenerateMaze();
    }

    
    public void GenerateMaze(){
        for (int i = 0; i < NumberOfWalls; i++){
            float x = Random.Range(-MazeSize, MazeSize);
            float y = Random.Range(-MazeSize, MazeSize);
            Vector3 Position = new Vector3(x, 2.23f, y);

            GenerateWall(Position);


        }
    }

    void GenerateWall(Vector3 Position){
        GameObject wall = Instantiate(Wall, Position, Quaternion.identity);
        int RawRotation = Random.Range(0, 100);
        if (RawRotation < 50){
            int Rotation = 90;
            wall.transform.rotation = Quaternion.Euler(0, Rotation, 0);
        }
        
        if (RawRotation > 50) {
            int Rotation = 0;
            wall.transform.rotation = Quaternion.Euler(0, Rotation, 0);
        }

        


    }

}

Take away .collider. Just change collision.collider.gameObject.CompareTag("Wall")
to collision.gameObject.CompareTag("Wall"), and change Destroy(collision.collider.gameObject); to
Destroy(collision.gameObject);