Like in the UK , in Spain there is no obligation to take life insurance from the bank however it is unlikely that the bank will give you a mortgage unless you take their overpriced life insurance
Because the law allows the buyers to then change the provider, after the one year, what the bank then do it insist that you take a full term insurance plan, in other words that they charge you for life insurance for the full term of the mortgage and add this to the mortgage, so for example if the mortgage is 10 years and the premium €1k per year, €10k added to the mortgage costs
The next catch is that if you them don't take the insurance they increase the percentage
What you really need id some independant advice, a broker may charge you an arrangement fee but could save you money