The simplest solution is to use J.R.'s suggestion. Remove the existing rack from your Trek and replace it with a double layer rack which will hold a flat battery. The trick is to find a double layer rack that will allow you to use your quick attach Topeak bag.
I did something similar with my Pedego Interceptor where the battery is mounted under the rear rack. The double layer rack idea won't work since the Pedego rack is not removable. I had to make my own. In my case, I have a collection of Bontrager / Electra quick attach bags which I use on my Trek MTB's. I made an "adapter" to hold a second battery and allow me to use my Bontrager accessories.
I made an aluminum battery box and mounted it to the top of the Pedego rack using insulated cable clamps. No modification to the bike was necessary. I chose to use a second OEM battery and just swap them instead of using a switch.
View attachment 30468 View attachment 30469 View attachment 30470
Next, I cut the top off an old Bontrager rack and mounted it to the top of the aluminum box using the same clamps.
View attachment 30472 View attachment 30471 View attachment 30473
I can now carry a second battery and use my Bontrager quick attach bags.
View attachment 30474 View attachment 30475 View attachment 30476
When not carrying a second battery, the box can be used for other gear.
View attachment 30477
The same design can be used with Topeak or almost any other brand rear rack system.