Probably a combination of things;
1) Eshelman had no future here, a number of pitchers would have been promoted and passed him by August
2) Baltimore had a $1M they couldn't use so anything was a positive gain
3) Phillies probably have a few targets they're willing try to sign them in the next few weeks, could be late birthdays, could be hidden gems, could be players who overestimated their value and don't want to compete against the next group of younger prospects in July. They might have deals lined up, or just prepared to make a last minute push.
It's a no risk move, the slots don't cost anything, only if you actually use them, and in that case they've added prospects for "free" (MIddleton's money is free from my perspective!).