Assuming for the moment that there are no contractual issues, would it
be ethical to consider applying for a job with the consultant in a
situation like this
Yes. Absent anything in your contract (non-compete clauses, solicitation of clients clauses, etc) it's perfectly ethical to seek a job anywhere you like.
The consulting company may have issues with hiring you (they may not want to risk burning any bridges with your current company, and may even have an agreement in place not to hire anyone from your company). If you are particularly friendly with any of the consultants, you might ask them privately about their company's policies in this regard.
Still, it's smart to have these folks in your professional network either way.
I once worked at a company where we brought in some automation software. I was part of the Beta program with the software vendor, and got to know a bit about them. When things started to go south in my company, I called this vendor, got an interview, and ended up landing the best job I ever held.
and if so, how long after the project should one wait?
It makes sense for you to complete the project first as you are suggesting. But once the project is complete, there's no real need to wait at all.
If the consulting company has agreements not to poach employees from your company, you might want to wait at least a few months after they are no longer working with your company.