Is there an easy way to build a url for attachments in a Hosted Feature Service from the attributes of the features so I can display them in the popups?
No, there really isn't a way to do this. Attachments are listed in a popup by name as a link. If you click on the link, it will display outside of the popup.