How many package managers allow executing arbitrary code as part of the installation process by default?

Almost all of them.

I haven’t seen this in Go or Java?