To be honest, this is a good way to strengthen ones skill or resume but the need to have a stable means of income would affect dedication to this project, except they have stable income and time for it.
Unless the open-source product is produced by a company that has a relatively steady cash flow and a fixed amount of employees, then getting a salary isn't guaranteed. In fact, it's the opposite!
Are there open-source products produced by companies that pay their devs? Of course! And you can also contribute in these products,
but if you 're not in their payroll, you will not get a salary.