European migration laws forces these people to conduct this dangerous voyage because you can’t get asylum without crossing the border.
Offshore resettlement programs exist in Europe and around the world. The problem is that there exists little incentive for people to remain in a refugee camp for what could be years when the option of travelling directly to their country of choice is an available option.
A solution is for countries to relocate all asylum seekers back to these refugee camps where they have no option but to wait with everyone else for resettlement. There would be no incentive to risk your life to cross a border if you’re just going to end up back in a refugee camp along with other people who are waiting.
Currently, in my country at least, there is an onshore humanitarian program and an offshore humanitarian program. Most of the people granted refugee visas in the offshore program are from war-torn countries like Afghanistan or Syria who escaped to a third country. The top five countries of origin for those that apply for onshore protection are from tourist destinations that haven’t seen war in decades. Hosting asylum seekers in UN refugee camps also helps prioritise those most in need.