Not all bacteria are biofilm-forming. It depends on the bacterial environmental condition. Initially, bacteria are in the planktonic state. It develops a biofilm-forming gene due to harsh environmental conditions. Mainly biofilm forming bacteria are observed in the slimy environment, and these are highly antimicrobial resistant.
Biofilms or bacteria (planctonic state) can colonize sites initially colonized by viruses because they develop new receptors to bacteria(superinfections)...Moreover some biofilms like oral biofilms may contain some viruses such herpes viruses (ex endodontic biofilm) but those ones may not have necessarily an effect on the endodontic lesion directly.