To identify the right copdem and srtm tile from a S2 tile I propose to use the eotilepackage which provide you the possibility to identify the corresponding id.
As long as we have a DEM tile database that associates footprints to tile names (under the "id" field), I don't see the point of introducing another dependency that'll require to clear out useless information (regarding S1Tiling needs)
The missing step (that eotile doesn't appear to solve either) is the final association tile-name --> directory/file-name.extension which may depends on/varies with the source of the DEM.
So I don't see the added value of eotile. Is it may be the gpkg database for strm5x5 tiles which could be missing with the original products? Then all we have to do is to document the database format we are expecting and add a way to configure the naming scheme tile-name -> full-pathname for the desired DEM product.
After further investigations: eotile seems able to store the typical name of some Copernicus DEM files but I don't see any way to extract that precise information from eotile API. However, the 2 .gpkg files are a good start.
Either we stole the two gpkg files, or we could depend on eotile for at least the file already available.
The simplest and more evolutive approach would be:
To be able to specify a gpkg (or any other similar type of file) where the association fid, "id" and geometry is stored.
To be able to specify the exact field id to use (could be "id" by default; With eotile DEM_Union.gpkg file we would use "Product10" and "Product30" for Copernicus sources for instance)
To be able to specify a filename format to use. By default: {dirname}/{id}.hgt