Not exactly; there are two separate instances of recorded play time—the one that’s saved to your Nintendo Account and can be seen by you and your friends on your profile, and another that’s saved to the system itself and is used for sorting games by play time on the HOME Menu. The latter is hidden from view outside of sorting your games by play time, and it’s also not profile-specific; rather, it records the play time for all games across all accounts that have ever been used on the system, and because it’s not tied to a single account it cannot be transferred off the system, unfortunately.
The former, however, does transfer to a new system if you do a proper account transfer. If you just sign in to another system without actually going through the transfer process, though, then your play time data won’t properly transfer; you’ll still have your old play time shown on your profile page since it syncs to the online servers, but it will no longer be accurate because any play time won’t be updated until you surpass the time on your account on the new system. So, for example, if you had played 10 hours of a game on one system, then logged in to another system without doing a profile transfer and played another 5 hours, it would still say 10 hours since you haven’t surpassed that time on the current system; if you played another 10 hours, making 15 hours total on that second Switch plus the 10 hours from the first Switch, your play time would only say 15 hours despite the fact that you actually played 25 hours total.
So, basically, if you care about having accurate play time on your account, don’t ever play games on another Switch unless you’ve done a profile transfer to that system. And, unfortunately, your old play time isn’t going to be able to be used to sort games by play time on the HOME Menu if you ever transfer to a new system, so that sort feature essentially becomes useless unless you never move to a new Switch.