Pages are primarily written for display & human consumption. Whatever was left of the "semantic HTML" went out the window when everyone switched to the JS SPA fad.
As far as I know there is no "right" way to design a JS SPA overlay/loginwall in a way that search engines ignore it - it's not like Pinterest is intentionally ignoring a spec or designing a page that misleads search engine crawlers (other engines seem to handle Pinterest just fine). Outright denying access to search engines could be wrong because logged-in Pinterest users may actually want those results, so that's not a good solution either.
The fault is ultimately on Google for ignoring this high-profile issue for such a long time because it contributes to their bottom-line, even though a very simple, low-tech fix (easier than making the crawler recognize such loginwalls reliably) could be to just allow users to make their own decision as to whether to block the domain, like Kagi has done.