Also, the launch of Polski Bus (a localized Megacoach) a few years ago means you can get between Poland and various Central European destinations for as little as 5€, again cheaper than the train.
P.S. Polski Bus has been absorbed into Flixbus.
Last time I checked the only way to have a 9:00 meeting in the center of Copenhagen, leaving from Aalborg (400km away) is by leaving at 23:00 the day before. It's a 6.5 hour train ride. Flying is 20 minutes and you have multiple departures and airlines every morning (granted you have to be at the airport 20 minute early and it a 30 min trip for the airport to the center of Copenhagen).
When people talk about how great trains are in Europe, I assume they never had to used them. Trains absolutely suck, they aren't fast enough, not frequent enough and they are expensive. It cheaper and faster to fly or drive.
When people generalize across Europe, which you've just done, it should often be ignored. They tend to pick the best or worst examples.
Denmark (and Greece) have the least favourable geography for land transport. That favours flying, but doesn't mean flying from Nuremburg to Berlin is necessarily the best option.
Norway would like a word with you there. Denmark’s got a lot of annoying coastline but at least it’s flat, small and relatively densely populated. One of the things I miss most here on the Norwegian west coast is the lack of useful rail connections.
At the same time, I was delighted to travel with trains in Czech Republic when I lived there for one year. Not sure about other Eastern European countries.
In Western Europe, low-cost flights and buses essentially won the market.
But there are not as many direct flights between Central and Eastern European cities, and the roads are often not that good, either.
Therefore, in any direction from Budapest overnight trains are still very popular, and in countries like Ukraine it's probably the single most important way to travel long distances.
The overnight trains in Central and Eastern Europe are much cheaper, too. For instance, a seat in Budapest - Belgrad costs 15€, and a bed in Kiev - Lviv starts at around 8€.