When an action or proceeding is commenced by or against a county, city, or other political subdivision or agency of the state involving the title to or the boundaries of tidelands or submerged lands that have been or may hereafter be granted to it in trust by the Legislature, the State of California shall be joined as a necessary party defendant in the action or proceeding.