You cannot go everywhere even if you have 3 months rather than 6 weeks. All your planned destinations are good ones. So are other places you haven't mentioned--your trip is overwhelmingly focused on quite large, touristy cities. Just figure the places you don't get to this year can be part of the next trip. That's better than trying to cram in too much and spending a lot of time sitting on various forms of transportation.
It obviously takes considerably more time for good visits to Gdansk + Warsaw + Krakow than to visit Vienna alone. How do you feel about the amount of time allotted to your other stops? If you think you'll be pressed to accomplish your sightseeing goals in the other cities, maybe subbing Vienna for all the Polish stops and distributing the left-over days to Budapest, Berlin, etc., would be a good option. (I do love Poland; I spent 5 weeks there in 2018.)
To my mind, both itineraries are cutting Berlin very seriously short. Although Berlin itself is not particularly physically attractive due to wartime damage, it has many, many time-consuming museums and historical sites. It's a large city, and the top sights are rather scattered except for the multiple museums on Museum Island. I'd suggest that you postpone Berlin until you have enough time to see it more comprehensively, but it appears that you are flying in and out of that city.
Dresden is not a place to which I'd plan a half-day trip. It was fire-bombed during the war and has a fairly small, though handsome, central area rebuilt in the historic style. Many towns and cities have more old (or old-looking in the case of Dresden) buildings than you'll find in Dresden. What Dresden has is some magnificent museums. Large museums. A half-day, to me, would be of questionable value, and you'd be spending a good bit of time changing hotels for just one night. I'd go straight to Prague and try to find time at some point in the trip for a visit to a smaller town.