Modify $PATH while unpacking archive in Linux
No – the '.tar' archive is just a file archive and nothing else. tar
is not a package installer; it will not put files in e.g. /usr/bin unless you ask it to literally extract the whole archive there.
In general, it is nowadays considered a security issue if a tool can be tricked into placing files outside the specified destination directory, and paths such as ../../../usr/bin
are not allowed by default. (There's an option to allow them in GNU tar, though.)
Also, on many systems, $PATH does not contain any user-writable locations by default – it would have to be modified first (or the installation done as root). There is no generic way to add stuff to $PATH – you'd need to take into account many different shells and login environments, and the user would still need to log out for the changes to apply.
Finally, the ability to add executables to $PATH (or to run post-extraction scripts) just invites abuse. While such an ability would be fully expected from a package manager app (e.g. if you run "npm i -g" or "cabal install"), it would be completely unexpected from a plain old file archiver.
(Most likely, if it had been supported by tar, nobody would be using tar to extract files – they'd be using some alternative "safetar" and you'd just be back to your original problem.)
You should create an actual deb/rpm package. Those are literally meant to be installed into $PATH.