I don't know if I've understood your problem completely so let me know if I've gone off on a tangent.
We do the following in our environments:
- Backup and restore the publisher DB on our dev/test environments. If we have replication setup in these environments we first drop the existing replication setup before doing this. When we drop the existing replication setup we take care of removing everything - all publications/subscriptions are removed, distribution DB is dropped and distributor is removed.
- Run sp_removedbreplication to get rid of all the replication related settings on the restored publisher DB
- Configure replication in our dev/test environments using the restored publisher DB as the publisher.
The detailed steps we use to remove the replication setup are:
a) Run sp_droppullsubscription on each of the subscribers for each of the subscriptions (for pull subscriptions - this is not needed for a push subscription)
b) Run sp_dropsubscription on the publisher for each of the subscribers and each of the publications
c) Run sp_droppublication on the publisher for each of the publications
d) Run sp_replicationdboption on the publisher to set the publish option to false
e) Remove the distributor setup - run sp_dropdistributor, sp_dropdistributiondb and sp_dropdistpublisher on the distributor
In our environments we have some extra checks to take care of removing the replication setup for only one subscriber (we have multiple subscribers and need to be able to drop and setup replication for one or all subscribers). This method has worked well for most of the time for us - there have some instances where we had network issues during the deployment which caused some weird problems but otherwise this approach works fine for us.
I can share our deployment scripts if you want - though they'll probably be pretty confusing (we're trying to move our deployments to powershell sometime in the near future and hopefully things will be easier then ;-))