From what I understand you want trafic that come from ProviderA to go back to ProviderA and trafic that come from ProviderB to go back to ProviderB.
I don't really understand "I don't want to hardcode the IP addresses", as a /24 will not be dynamic. So I would do a route-map based on the source address. It's not 100% good because you may have received trafic on ProviderA IPs from the ProviderB link even with AS prepending and you will send back the trafic to ProviderA instead of ProviderB but it will be Ok most of the time.
access-list 101 permit ip PROVIDER_A_SUBNET 0.0.0.255 any
access-list 102 permit ip PROVIDER_B_SUBNET 0.0.0.255 any
route-map SOURCE_ROUTING permit 10
match ip address 101
set ip next-hop PROVIDER_A_ROUTER
route-map SOURCE_ROUTING permit 20
match ip address 102
set ip next-hop PROVIDER_B_ROUTER
Then apply policy route-map SOURCE_ROUTING on the interface that receive data that need to go out.
Best Answer
Generally no.
The upstream(s) need to explicitly configure their routers to let you connect to them and receive their bgp feed.