"requires candidates need to be able to work on a W2 basis"
They are looking for an employee, they are not looking for somebody who works for a different company, or who is an independent contractor.
why? That is their preference. They may want to give you additional duties that they don't want contractors to do.
They could even have a requirement. The government is giving them a contract to complete a task and is telling them that they must keep 51% of the work in house. This is done when they won because they are a small business and the government wants to keep them from taking a 10% and then having all the work done by a big company.
Is there any way for a contractor from a consulting company to receive
W2, so that they can qualify for such positions?
They want to hire a w2 position; they don't want to send a 1099 to a consulting company who then gives you a W2. So, no.
Bob's programmers want to hire an employee. So they advertise on a job board they include the line: "candidates need to be able to work on a W2 basis"
Bob's programmers doesn't want a contract with we_are_coders. If you aren't willing to quit we_are_coders and become an employee of Bob's programmers, then don't apply.