I don’t believe that’s possible. I think at one point there was a way to disable all access to the history API, but I don’t believe that option exists anymore. Additionally, it would break a lot of websites.
Unfortunately I think this is probably a result of the way YouTube implements their “auto play next video” feature, and they are unlikely to change that.
An option might be using an alternative YouTube front-end, rather than using the YouTube site, but I don’t have a lot of experience with those. (other people on here do though)
There’s actually a Python-based framework that can make mobile apps called Kivy, but as you might expect it would not be terribly performant.