Character displacement promotes cooperation in bacterial biofilms