That will never happen.
The topic of how to handle immigration and illegal immigration (two distinct and separate issues) is hotly debated. My answer is about the current state, not necessarily addressing how it should be or whether or not it is the right way.
The basic answer is that we will not stop detaining people crossing the border. It is important to note the difference between detain and arrest as they are not the same.
Detention is a temporary process law enforcement uses to investigate activities or in pursue a possible crime. Usually a detention is initiated though probable cause. A law enforcement officer conducting a traffic stop is detaining the stopped person. They may also detain an innocent bystander near a crime to assess if that person is a witness to the crime.
An arrest is usually coupled with being charged with a crime, though not always.
All persons entering the US legally are detained at the border. This may be a brief 30 second interview with a border agent, or several hours, but detained you will be.
Customs and Border Protection processes entry. It doesn't authorize it immigration.
The agents at the border process a request for entry in accordance with the rules for the request. They assess that you are following the rules and determine if your authorization is valid. They are not the agency that authorized the entry determines a person's legal status within the country. That authorization decision is done through other agencies (passport, visas, immigration court, etc.).
Border patrol agents should be given the authority to determine if a migrant is in imminent danger and might possibly qualify for political asylum.
This is an unbelievably dangerous concept. It basically gives a law enforcement agency judicial powers. The current process means that someone that enters the country illegally but still claims asylum will have the opportunity to present their case to a judge, or, in a more important manner, an impartial 3rd party between the law enforcement agency and the accused. The US offers an innocent until proven guilty mantra in its courts that it does afford to non-citizens.
To allow agents to determine if an asylum claim is legitimate or not will dramatically disenfranchise the immigrant of due process.
International borders are complicated.
Anything to do with transferring of anything between governments is complicated.
If illegal migrants are picked up at the border, patrol agents drive them back to mexico instead of detaining them.
This is confusing with your question. The act of picking up the illegal immigrants is the US government detaining them and taking them into custody. To not detain them would be to allow them to freely go about their business (presumably to continue into the country illegally). Then, putting them back into Mexico would be the US government deporting those individuals to Mexico. This action is governed through a treaty between the countries. Mexico, rightfully, doesn't want us to deport non-Mexicans to their country.
That or another interpretation of what you are asking is to close the border with Mexico. Yes, we can do that. Some politicians might want that, though I am not aware of any publicly supporting this idea. The diplomatic consequences would be far more costly than the few hundred illegal immigrants and various drugs that cross the border on a daily basis though.
I want to address this separately:
Legitimate asylum is no joke.
Change the asylum law so that if someone wants to declare asylum they
can submit an application but till they're approved we do not detain
anyone.
It is important to understand what asylum is. This is a system for providing refuge to a person being driven from home. It is common for legitimate asylum seekers to face deadly consequences if they return from where they came. This is not something that can be adequately anticipated or addressed with an application prior to making the claim.
The whole point of allowing someone to claim asylum at a port of entry is to afford them both temporary protection and the chance to review their claim. Here we are detaining them precisely for what they are seeking. The detention of asylum seekers offers the individual protection of the US government from whatever they are seeking asylum from while their claim reviewed.
Edit: Changed a word.