usually scripts have versions, this protects you from compromised cdns as well where you publish assets in a different location compared to where your frontend is served.

If a library serves a script and your site manages user funds you should probably avoid using it or use a cdn that does.

I am not quite sure, but there's also other integrity mechanisms that gurantee that a file was signed by the library developer via a served header with the signature of the file.

Why would you even load a library script from a third-party when hosting it yourself is more performant and more secure?

There's a lot of very weird websites. You still benefit from checksumming your own assets to prevent cache poisoning and so on.