There are already dispensing machines that dispense doses on a timer. They are mostly targeted at people who need reminding (e.g. Alzheimers), though, rather than people who may want to take too much. I don’t think the cryptographic security would be the problem in that scenario, but the physical security of the device. You would need some trusted way to reload it and it would have to be very difficult to open even though it would presumably just be sitting on your table at home, which is a very high bar. It could possibly be combined with always-on tampering reporting and legal threats to make the idea of tampering with it less appealing though.
There are already dispensing machines that dispense doses on a timer. They are mostly targeted at people who need reminding (e.g. Alzheimers), though, rather than people who may want to take too much. I don’t think the cryptographic security would be the problem in that scenario, but the physical security of the device. You would need some trusted way to reload it and it would have to be very difficult to open even though it would presumably just be sitting on your table at home, which is a very high bar. It could possibly be combined with always-on tampering reporting and legal threats to make the idea of tampering with it less appealing though.