I don't get this.
When I was unhappy at my last job I was way less productive.
Now I'm enjoying my new job and spend my time solving real technical problems and building real projects.
I was considering taking a pay cut just to leave my last job it had gotten so toxic. You can pay employees less if they're otherwise satisfied.