This wouldn’t be possible, and also I don’t think it’s a good idea because if something like this were to be implemented, it would slow down the refreshing of the menu. It’s important to have the menu load quickly and be responsive and checking stock on each refresh would have a considerable amount of additional queries. Plus the menu is cached and it would likely conflict with that.
Maybe you can consider implementing this tutorial, I think it will work for your needs as you probably don’t need to know stock of every single item and you can just select an item to check the stock when needed.