How does telling your boss you are interviewing help? What does each party gain? The “very worst you’ve done” is not put someone on a long term project. That is detrimental to your direct report’s career if they decide to stay. No one wins.
Obviously this varies, but if you have a good relationship with your manager, this can be a huge benefit down the line. That person can be part of your professional network, and may possibly reach out to you several years down the line with a new position at the new company they work for. Leaving right after a large project has been assigned to you does have a negative impact on your manager and current team, so it may be beneficial to let them know early.
People change positions fast in this industry, so keeping on good terms with coworkers you respect can be good later when they have moved on and are looking to hire.
As someone who's had a direct discuss this with me, it put a fire under my ass to apply pressure at higher levels to address to reasons they're looking elsewhere. Pay, responsibility, lack of opportunity for upward mobility. I was able to provide assurances that a raise/promotion was likely during the next evaluation and even openly discussed my professional rating of them (including stratification) when I submitted for end of fiscal year.