Or at least some employees do. At some companies it happens unofficially because the company actively forbids or requires an onerous approval process to contribute to open source.
I get a bit ticked off that companies get credit for contribution or projects and the individuals actively behind those contributions and projects are largely uncredited, especially when it only happens against the wishes of the company, that retroactively decides it's good press to take credit for their employees' work.
Wager there's a lot of room for this to happen, a popular thing in companies to show they care is a pledge to match up to some nominal amount donated by employees to the same cause.
I do wonder if some of these companies attach a "don't credit us" clause, since they are leaving it to the employees to pick causes, they might not want to get associated with a cause just at the whim of a random employee.