I mean all Linux package managers allow running arbitrary code on install/uninstall and it seems to work well enough.
Regardless, installation on Linux is often just dropping some files somewhere and perhaps a modprobe.
In Windows you have so many things you can do: filesystem, registry, COM registration, GAC, file associations, etc.
registry -> dconf
com registration -> dbus objects
gac -> shared libs
file associations -> dconf settings
windows scheduler entries -> systemd user sessionAnd the GAC isn't really comparable, perhaps WinSxS is comparable, but the GAC requires a specific API and isn't a matter of just dropping a file in /usr/lib.