I can answer this for the UK and Schengen members...
In the first instance, consulates take your passport because there are some laws involving how a visa is issued. Prominent among those are...
Paragraph 24, which states...
The following must produce to the Immigration Officer a valid passport
or other identity document endorsed with a United Kingdom entry
clearance issued to him for the purpose for which he seeks entry:...
Paragraph 27, which states...
An application for entry clearance is to be decided in the light of
the circumstances existing at the time of the decision...
Paragraph 28, which states...
An applicant for an entry clearance must be outside the United Kingdom
and Islands at the time of the application...
(These rules are all found at Immigration Rules)
From these it's clear that they need to take possession of the travel document in order to assess its validity. And from Paragraphs 27 and 28 they need to be sure that the conditions of issuance are 'fixed' to a specific date and time. It means that the applicant has not travelled with the passport in the interval between submission and issuance, and (to the extent possible) the applicant is not in the UK when the decision is made. In addition, the Entry Clearance Officer has to assess the application. These things cannot be done 'while-you-wait' and holding the passport helps to guarantee that Paragraphs 24, 27, and 28 are diligently observed.
There are some practical and administrative considerations that come into play...
Those visa stickers are affixed to the passport page by a machine and
there's usually one machine per post. The passports need to be
sequenced, fed in to the machine, and then checked by a human. This
is done as a background task by local hires who may be on shift work
in a batch. Trying to arrange a batch according to whoever showed
up is administratively impractical.
In the UK case, they don't like people hanging around the consulate,
they like to make the decision entirely by paper-based evidence (they really do not like to engage the public directly for various reasons not worth going in to here).
Moreover, the security is not staffed up for lengthy queues. So they
use a VFS to ring-fence the consulate from engaging directly with the
public (yes, there are exceptions where they need to see someone but
these are not the normal case).
In keeping with the above, most of the world is set up to use the
Visa Facilitation Service (VFS) as a intermediary, the applicant
drops off their stuff and then returns to collect it when they get a
notification email. The VFS has no decision-making role and largely
acts as a secured courier, so it really makes no sense to have a
queue of people hanging around the VFS waiting for a visa to be
In places like Nigeria, the passport and evidence may be sent to
their special assessment unit that performs 'deep analysis'. This can
take several weeks and it would not make sense to separate the
passport from the other evidence during this phase.
In the Schengen cases where the applicant must report to the
consulate for an interview, it would mean making two trips to the
consulate: one for the interview and one to collect their stuff, this
is thought to be an unreasonable burden on the applicant.
Especially in the British case, there is an overarching cultural influence best called:
'this is the way things work' (TITWTW, 'titwah'). This usually operates as a
stand-alone rationale for a lot of things in the UK and visas are no
exception. If you encounter TITWTW, the discussion has reached its conclusion.
Other answers in the archives here have pointed out that the
application location is not necessarily the decision location.
Applications submitted in Morocco for example are decided in Croydon
(London suburbs). Applications submitted in Kabul are decided in New
Delhi (graphic from UKVI presentation). So where would the applicant queue?
And as a final note, yes, it's possible for an applicant to have an ECO come around to their house or office, or for an applicant to show up at the consulate on a while-you-wait basis. They are very flexible and will accommodate almost anything you want (I attended the Parliamentary debates on this topic and can attest to the flexibility). I haven't checked recently but the last time I looked, those services started at about GBP 15k and upwards from there. A person can also arrange for a private landing interview at Heathrow (etc) and they will even send someone to small airports like Robin Hood.
Note: most of the above are stated as UK specific, Schengen members have comparable or similar conditions.
Note: dual nationals (or holders of duplicate passports) always come up with the corner case: can I apply for entry clearance with one passport and simultaneously enter the UK on my other passport? This is theoretically possible because the IO may not always know that the person has applied for entry clearance using a second passport. But returning to Paragraph 28, if they ever find out that the person was in the UK during a pending application for entry clearance, the person becomes an illegal entrant for that period of time. That will have grave impact if the person ever tries to get another entry clearance or apply for British nationality, etc. So the bottom line is yes, but you are implicitly accepting the consequences.