Typically a bank mortgage would be secured by the property, not by other assets of the purchaser. Some (but not all) stocks / options might be restricted from being pledged/liened/hypothecated/etc, so they might not be available for “Loan me $5 million (to buy a house), secured by these shares.”
But because the bank is in the business of making mortgages against property, it won’t consider the shares as security in most cases. It may consider them as positive evidence in favor of one’s ability to service a mortgage, much like it would consider your income as evidence of ability to service the mortgage. It doesn’t have recourse against your income in event of a default.
(California is a no-recourse stage; talk to a real estate lawyer or similar professional if you are curious on the precise application to your situation, HN.)