I am not a professional - this is amatuer advice.
Marriage is a legal contract to share your lives, including your future financial prosperity. This creates the security which allows us to take risks with our individual prosperity (e.g. by taking maternity leave).
A mortgage is a legal contract enabling individuals to buy a house they couldn't otherwise afford, with a legal obligation from the borrower to make repayments to the lender, and the lender has the right to take posession of the house and auction it off to the highest bidder if the borrower fails to keep up the payments.
Being on named on the deeds to the house is what confers ownership. It is possible to be named on the deeds of the house without being named on the mortgage. There is more than one way of being named. You can be named as a co-owner, you can be named as having a "charge" on the property (an amount of money which is due to you if the property is sold), you can be named. I think I recall that it is possible to also be registered as a resident in the house which gives you some rights against being evicted but I can't remember the term for that.
Being named on the mortgage isn't the key issue - that is just the person who is agreeing to stick to the terms of the loan. What you need for security is reliable acknowledgement that you have rights over the asset which is the (gradually increasing as you pay off the mortgage) equity in that house. That is most simply acquired by being named on the deeds as a co-owner - that might require the agreement of the mortgage lender.
If you don't get divorced, and he dies first, and if he nominates you as the sole or main beneficiary of his Will, then it makes no difference.
If you don't get divorced and you die first, then what happens will depend on his decisions after that - he could remarry and disinherit your children for example. That would be a major concern for me.
If you do get divorced then whose name is on the mortgage shouldn't make a huge difference but in practice it can do. However, ostensibly all "assets" held by either party to the marriage are considered as part of what has to be divided up. Some consideration would be given in the event that one party had very large assets before the marriage and one did not, if the marriage was of relatively short duration. However, it is not at all unusual for a woman who sacrificed her own earning potential in order to follow a family-friendly flexible but lower-paid career path might get a larger share of the assets in recognition of this. The work that one person in the partnership which earns money is not of higher real value than the unpaid work that the other person does to create and sustain the family environment at home, therefore all assets are "joint" whoever nominally owns them. The name on the mortgage wouldn't prevent that from being decided in her favour if it was appropriate.