I didn’t major in CS, but I wanted to take some CS classes. Several times I had to go back and forth with the course instructor and the director of undergraduate studies in the department, trying to convince them to let me take the class, or at least audit it or get access to the course materials if it was filling up.
I was mostly successful, but there were a couple times where I was told I simply could not take the class because I didn’t take the prerequisite. As a lifelong computer nerd and capable programmer, I could have sat the exam for the prerequisite classes without preparation and passed, but they did not allow this.
If there are open spots in the classes after all the CS majors signed up for it, then why not just let anyone take it if they’re up for the challenge? You can warn them about the prerequisite knowledge, so if they fail it’s completely on them.