$! is guaranteed to give you the pid of the process in which the shell executed that
tail command. Shells are single threaded, each shell lives in its own process with its own set of variables. There's no way the
$! of one shell is going to leak into another shell, just like assigning a shell variable in one shell is not going to affect the variable of the same name in another shell (if we set aside the universal variables of the
tail -f /dev/null is a command that runs indefinitely, but for short-lived commands, note that since there's a limited number of possible process ids, process ids inevitably end up being reused.
$pid will contain the id of the process where the shell ran
true, but by the time you use that
$pid, that pid may well be dead and could be referring to a different process.