Yes, but it is up to the individual Apple Authorised Service Provider whether they will do the upgrade. Some may not.
From: Install memory in an iMac
Memory is not removable by users on iMac (21.5-inch, Late 2012), iMac (21.5-inch, Late 2013), iMac (21.5-inch, Mid 2014), iMac (21.5-inch, 2017), iMac (Retina 4K, 21.5-inch, 2017) and iMac (Retina 4K, 21.5-inch, 2019). If the memory in one of these computers needs repair service, contact an Apple Retail Store or Apple Authorised Service Provider. If you’d like to upgrade the memory in one of these models, an Apple Authorised Service Provider can help. Before you schedule an appointment, confirm that the specific Apple Authorised Service Provider offers memory upgrade services.