Escape dynamic and configured theme names in the same way. (#15309)

Change-Id: Ib7fd42e6017d0b78e6d5e6bd7f531f0cd6c8c0ab