I was never a big fan of using earplugs, so maybe my opinion will be a bit biased, but I want to point out some problems.
Pushing the wax deeper and deeper
Earplugs usage is often related to more wax buildup and ear infections, since the earplugs, the same as cotton swabs, act like a ramrod in an old-style cannon - pushing the wax deeper and deeper into an ear canal. Therefore, making in foamy would definitely make it less "dangerous" in that sense, but the negative impact on the ear would still exist.
The benefits of an ear wax
Besides, wax has antifungal and antibacterial properties and is therefore useful. On the other hand, excessive daily removal of wax by such earplugs, if made efficient, could possibly make the ear more susceptible to infections due to a significant reduction of the ear wax.
I think these facts should be taken into consideration while designing an earplugs or similar noise-cancelling gadget.
Please leave the feedback on this idea