Obviously you don't do that for every binary you run, but you have options if there's something you're a bit suspicious of.
But that only helps power users. On linux learning these things is simply a necessity because installing things outside your package manager is even less user friendly.
My personal opinion regarding security I would say is easy ability to apply sandboxing at various levels on the user side for software we trust less. (By user side I mean not depending on the developer to package the app a certain way etc. A virtual machine or a chroot jail etc are examples of what I meant by this).
And that's in the cases where they (or trusted third parties) aren't actually packaging it already for more normal installation in the OS you're on.
So, I'm not being idealistic and saying "read the code of everything you run", I'm saying "realize that running random scripts is equivalent to running random executables in a lot of cases, so maybe don't do that no matter the OS, as it's not an OS problem and one OS won't really protect you regardless of whether it's Linux or Windows or Mac OS", and thus it's not really a Linux problem at all. As an example, I'll leave you with this[1], which I find fairly relevant since it has the powershell equivalent if curl piping to bash.
1: https://deno.land/[email protected]/getting_started/installatio...
This take is reductive and should not be taken seriously.
edit: Editing to say, I do agree with the OP in spirit, you should try to avoid running untrusted software. But the devil here is in the details, it's simply not an easily feasible goal.