I gathered (and received a gift of 2 emeralds) to build two Tomb Dungeon Entrances. Then I went to a smelting station and double-clicked on Reshape Dungeon Entrance so that the game automatically took the ingredients and placed them on the smelting table - and I successfully reshaped the tomb dungeon entrance to a "Magic Mirror Dungeon Entrance". Then I wanted to turn the remaining Tomb Dungeon Entrance with the 2nd pattern ("Eternal Ancient Tome Dungeon Entrance") and doubleclicked reshape dungeon entrance, crafted - and could not find my magic mirror entrance anymore, expecting to find TWO patterned dungeon entrances. The problem is that "reshape dungeon entrance" does not take the next "normal" tomb dungeon entrance but to my surprise took the already patterned "Magic Mirror Dungeon Entrance" to create the "Ancient Tomb Dungeon Entrance". IMO doubleclicking the reshapt dungeon entrance recipe should first take unpatterned dungeon entrances before it tries to overwrite an already patterned dungeon entrance. IF I would want to overwrite an already patterened dungeon entrance I could put the parts manually on the table.
I think the logic behind the current selection process is just alphabetical order. I agree that it would be very nice if there was a way to implement what you are asking for. This is also a problem for crafting, enchantments, and masterworks across the board. I've gotten to the point where I usually only hold the 1 item I'm working on to remove this issue. Which is a time consuming work around, but helps me not enchant or masterwork the wrong item.
Yeah its so automatic by now - but I never let the table decide which items to use heh - also true for ingot moulds otherwise you end up with 20 of them at 10 durability I keep a chest next to every crafting table and have it open while working and transfer stuff in and out of that as I do batches of MW / enchants
A handy tip for molds/tools is that it will pick ones in the base inventory over ones nested in a container as first choice. So if you keep all your ingot molds (or bone needles or whatever) in a bag it will pull one out, cycle through it till zero durability, then pull a fresh one from the bag. That way you can keep a trunk called "Ingot Mold" and treat the 300/300 capacity as if it means 30000/30000 durability for instance.