While the D visa is not yet expired.
New visa will be issued from a different country (assuming it is possible)
While the D visa is not yet expired.
New visa will be issued from a different country (assuming it is possible)
In theory it ought to be possible, generally speaking, to obtain a C visa while you have a D visa, in order to enable a trip after the expiration of the D visa. In practice, the requirement to apply for a C visa from your place of residence makes this difficult. In your case, however, there is another more significant problem. You write:
On the day of Schengen visa application, I will have a residence permit application in process from the country that issued my D visa. But by the time I want to enter EU, D visa will not be valid. That's why I'll need a new visa.
You won't qualify for a type C visa because one of the requirements is to demonstrate your intention to leave the Schengen area, while you have no such intention.
To reenter the Schengen area with a pending residence permit application you should probably get another type D visa from the country where you are living. This may or may not be possible. Unfortunately, being stuck in a country during the processing of a residence permit application is a common problem that often has no good solution.
The specific solution (or unavailability of a solution) depends on your country of residence, since these matters are governed by national law. If you want some help with this, consider posting a question on Expatriates.