[basetemplate] Use a proper UStringIO instead of a simple list for components (closes #4542740) [applied]