As you've seen above, a mechanic's lien is not a case, but rather a security interest (another way to describe an economic charge) in a piece of real property. A mechanic's lien is a creature of the California Constitution. With a few exceptions, anyone who provides labor and materials to a work of improvement on real property, e.g., actual construction, supplying materials that get incorporated in the work, etc., has a mechanics lien. It simply exists by operation of law, for entities that contribute to a work of improvement. Just as a trust deed - also a lien on real property - is a security interest protecting the lender's right to be paid on the note, a mechanics lien protects a person's right to be paid for the work they performed to improve the property. In each case, the real property is collateral. If not paid, the lender or "mechanic" forecloses the lien, i.e., has it sold, and takes the proceeds in payment of the debt they are owed.
The "wrong" that usually triggers the use of the mechanic's lien as a remedy is a breach of contract, i.e., someone refuses or fails to pay someone else for labor and materials provided to a work of improvement.
Negligence has nothing to do with mechanics liens. Negligence is a unique cause of action based on tort law. Foreclosure of a mechanic's lien is a statutory cause of action involving real property law and contract law.
Hope this helps; let me know if you need further info.
Regards,