The nation’s affordable-housing shortage is fueling a fast-growing corner of the municipal bond market, as lenders securitize portfolios of multifamily mortgages to free up capital for new loans.