Cookie banners should really have been a browser preference like "allow microphone" or "allow location", at least the UI would have been the same per site, and the browser can actually enforce.
They are also done for performative consent. The cookie banners want you to think that you have control. They often offer an illusion of fine grained control. They argue "this can't be a browser feature because they'll get it wrong or not offer you enough toggles to find some magic compromise between our advertisers and your data".
It relates to why DoNotTrack headers failed. Everyone who claimed they would support stopped supporting it as soon as users and browsers voted with their feet that they actually wanted privacy. Performative privacy is better for the corporate bottom line than real privacy, every time.
This is why I hope more people contribute to the AdNauseum project. Trying to limit cookies and trackers is a losing game. We need to proactively add buckets of junk data for advertisers - that's the only way to get them to stop collecting so much.