First, I just need to throw this out there: You are trying to see a lot, over a large geographical area, in a region where train transportation is still not quite as fast as perhaps it should be. While it's commendable to see as many Holocaust sites as possible, I think you need to really consider what an emotionally draining experience this can, and likely will, be. I say this as a Central European historian; it is hard work to do and think about nothing but the Holocaust. And while the Holocaust certainly looms large over Poland, it is not all that Poland is. To go in looking only for Holocaust sites is to miss a lot of the country. My suggestion, then, is to make sure you are scheduling downtime between visits to Holocaust sites to see the churches and art museums, or simply linger on a square with a coffee and szarlotka.
That being said -
Definitely fly from Budapest to Krakow. The train will take between 7-9 hours. The plane will take one, and there's a direct LOT flight that gets you to the KRK at 10:35am for $72. It's very easy to get from KRK to the main train station, and then an easy walk to the Main Square. I would recommend staying in Krakow and not going to Oswiecim. From what I've heard, there's not much there, and staying in Krakow will give you some distance from Auschwitz, both physically and mentally, as well as free up a day to spend elsewhere. Arrive in Krakow on 7/17, be at your hotel by noon, and spend the day exploring the city. Go to Auschwitz on 7/18, and spend 7/19 in Krakow - the Schindler sites, or maybe something completely different - the salt mines.
Now, here's where it gets tricky, The train from Krakow to Lublin is an interminable slog. No, really. It will likely be over seven hours with a few transfers. You'll stop ever few minutes. It was one of the most frustrating train rides I have ever taken, and I don't believe the bus is any better. You're almost better off taking the express train to Warsaw and then the direct train to Lublin. Either way, this day (7/20) is going to be lost to travel and you will just have to accept that.
Others have given you links to explore how to get to the various places you want to go. I'll only say, again, that focusing exclusively on Holocaust sites means missing a lot of this beautiful area. I spent three summers in Lublin; it's a small, compact town that's easy to explore. Zamosc is a UNESCO World Heritage Site. Kazimierz Dolny is a cute little town famous for its rooster bread. Take time to take in these and other attractions. This is also an area where the Holocaust and WWII/Nazi occupation is going to be found all around you. Lublin Castle is where the Nazis held prisoners - and also is home to amazing frescos. It will take some work, but you can visit the Old Jewish Cemetery in Lublin; I went with a professor who how to get in, but it might be in a guidebook or online. When we went to KD, we stopped to look at a memorial of gravestones the Nazis had "repurposed" to pave a road.
If you want to do all that you've listed, I'd stay in Lublin 4 nights/3 full days. That gets you to 7/24, when you'll leave for Warsaw. Warsaw deserves at least 3 nights/2 full days - half a day to get there and get settled, one for your trip to Treblinka, and another busy day to tour the remains of the Ghetto, the new Jewish History Museum, and perhaps also the Warsaw Uprising Museum. And that's not including time to explore the main drag, the Old Town, or Lazienki Park. And that gets you to 7/27. I'll continue these thoughts in the next post.