I would like to be able to add a new feature layer within a popup window from an arcgis server. For example (purely hypothetical), you click on a state and it has 2 options: fire departments and police stations. You can then click on one of those options to add it to the map
I haven't understood question 100% but this might help you Custom popup.
You can add