Hypothetically, or in the specific case of facebook?
Companies imposing binding restrictions on themselves is vital to loads of types of business. An insurance company binds themselves to pay out if you make a valid claim, for example.
I think it's more likely this is to avoid problems with the slew of dating apps that depend on Facebook now that they're starting to roll out their dating feature.
Well basically every company releasing code under an open source or free software license does so it is quite common. I guess the answer to the "why?" is the same as always: they believe doing so is more valuable than not doing so.