The math I'm doing already incorporates all the factors you're worried about, and considers general account development.
Let me give an example: fusions are a bit complicated, so let's say there's a 2x speed event on. You want to farm until you get 50 6* legendary or higher pieces.
Method 1: Dungeon 25 solo
It takes 50 * 20 / .13 / .32 = 24'038 energy. The factors are #items * energy / legendary rate / 6* rate.
This takes you 1202 runs, at 4*5780 xp per run, you've farmed up 27'788'462 xp "for free".
Method 2: Dungeon 10h
It takes 50 * 20 / (.18+.05) / .32 = 13'587 energy.
This takes 679 runs.
Now you spend the remaining 10'451 energy on 12-3, that's 1306 runs. At 3*8650 xp per run, you've farmed up 33'900'431 xp. You're ahead 6M xp, using the exact same amount of energy, and getting the exact same amount of good gear (actually, 22% or 11 of your farmed items will be mythical instead of legendary).
I haven't even accounted for the thousands of mystery shards, millions of silver, and dozens of 3* chickens you'll get out of those 12-3 runs. I also haven't accounted for the higher sale price of the gear you're selling (you'll get more 5* leggo and less 5* rare, etc).
There's no ambiguity here. Method 2 is just better! You even get the additional upside that you don't have to do those 12-3 runs right now, or at all! HarleQuinn, you can spend the energy in sand devil instead! Trips, if you want silver, just use some of the extra energy on spider 20 (actually, 10h might beat it now in terms of pure silver acquisition).
The typical mistake that people without economic training make is to account for one type of resource, and neglect others. The trick is to convert everything into a common currency. Then you'll never make that mistake. I haven't done this completely here, as it's kind of hard to answer how much energy you'd be willing to pay for one mystery shard. But we can do a quick and dirty calculation. Let's assume the non-xp rewards in 12-3 are worth about 2 energy. Then we're only paying 6 energy for 12-3 runs, resulting in 45M xp. In other words, the silver, chickens and mystery shards from method 2 are worth roughly an extra 11M xp. With the 6M advantage in actual xp, that brings us up to a 17M profit. I'm still missing the extra silver from selling better gear, but it's probably negligible.
I did this same calculation comparing 20 solo against 10 hard. It was even more lop-sided. Around 80M xp advantage for 10h. Sorry folks, the math doesn't lie. Hard mode dungeons change everything.
QED
(like seriously, if I don't get like 10 thumbs up for this post, there's something wrong with the world)