A minor nitpick, but the "Cookie Law" that introduced these banners was way before GDPR, although the GDPR does have articles that also talk also about cookies.
The intent of the parts of GDPR which mention cookies (or, at least, what I assume the intent was) was to essentially "upgrade" the banner from a simple and largely useless notification (i.e "By using this site you agree to our use of cookies") to one of informed consent (i.e "Please click accept or deny the use of cookies to continue using this site").
Interestingly, as far as I am aware, no site or company has ever been taken to court or even fined for not using a cookie banner, despite some websites publically declaring they won't use it[0].
0: https://nocookielaw.com/