Weeding out as I've seen it is a class that requires a certain level of commitment and ability to either plan your work or tough it out that a high school just can't really prepare anyone for. So in a way the student isn't a "weed" but their motivation or maturity might be and they're free to retake the class once they know that university will require them to put in more work than high school.
If they can't put in the work then completing a thesis and graduating is going to be very hard and that happens the last year of uni so better to set the expectations early with a "weed out" class.
Ideally it's not weeding out but distributing into education paths which fit every student.
From my experience studying electrical and computer engineering, I definitely prefer that they chose to put hard electrical engineering courses in the first semesters because I knew immediately not to focus on them because I didn't like them.
I think the problem is that no teacher has the time to babysit a student. If they just don't care about their education or can't put the time in, they shouldn't be wasting their time and money.
Some students also just don't have the aptitude for an Engineering or Computer Science degree. It's better for everyone if this is figured out early. I know plenty of people that dropped out of a Computer Science degree because they hated it or thought it would be a great way to make money and were in over their head.
We had classes that were for 'weeding out' students in Computer Science. They involved calculus because if you couldn't pass this class, you wouldn't be able to handle the 5 or so classes after this class that required it.
I studied computer science and have been working as a programmer for about 20 years. The downside is that you're filtering a lot of people who would actually potentially be great programmers but are for whatever reason not good at calculus.
Either the unfit and uninterested get weeded out at the education stage or they get weeded out by no employer being willing to hire them; the former seems kinder than the latter.
A teacher who thinks this way is probably in the wrong profession. A university that operates this way is failing to educate the students it admitted.