The nation is in the midst of a big cookie boom. Beyond private-equity, venture-capital and franchisee investments fueling the expanse are consumers hungry for an affordable indulgence.