Upcurled tails come as a side-effect of selecting for friendly characteristics, i.e. the domestication process itself would appear to result in physiccal changes even when those changes are not part of the breeding selection criteria (you can include a seperation of coat colour into multiple distinct colurs and floppy ears).
So the upturned tail is not exactly (always) a selected physical trait but it's not quite the factory setting either.
In feral dogs that selection is likely still happening as a result of friendlier dogs being more succesful than fearful dogs (fearful dogs will scavenge near humans less, take food directly from humans less and, if they bite, more likely to be run off, injured or killed than the friendly ones).
In bred dogs there is definately some further selection going on for those breeds with exaggerated upturned tails, over and above the changes that happen as a side effect of domestication-selection.
Nice illustration of those changes seen in the famous fox experiment on domestication here which shows the changes mentioned.