The driver is logistics: You can package peanut butter in plastic, and if there's something like, a shipping crisis or pandemic, it can sit in a warehouse for months without spoiling.
If you can solve that problem cost-effectively, plastic packaging would disappear quickly.