Developers’ focus on high-end rentals is contributing to a shortage of more affordable units, causing rents for apartments aimed at middle-income tenants to rise at a faster pace than rents for luxury apartments.