Why is DNS not just a layer 3 for a layer 4 protocol? Because it does more than what is required at layer 3 or at layer 4. Let me try to be clearer right at the start. Your examples, DNS and DHCP, provide information that is ultimately required by layer 3, yes. But in order to compute and then transfer that information, DNS and DHCP require the services of all 7 ISO layers (assuming you are organizing your thoughts that way, which is a good way in my opinion)..
A layer 3 protocol simply routes packets, based mostly on the destination address, but potentially based also on other layer 3 header content (such as the TOS byte, or additional routing options, or even, potentially, the source address and the protocol being carried in the datagram). So, a datagram arrives at one port of the router, and it gets switched over and sent on another port. That's the job of layer 3.
So, any algorithm used to translate a name to a numerical IP address, and then return the answer to the requesting host, is clearly outside the scope of layer 3.
Layer 4's job is to deliver packets end to end, for individual sessions. A host may have multiple session open at the same time. Layer 4 keeps all these conversations organized, separate. Layer 4 may also be called upon to correct errors and to keep bytes in the intended order of sequence (e.g. TCP). But here again, any thoughts of reading names and looking up IP addresses, and formulating and then transmitting answers for the requesting host, are outside the scope of layer 4.
DHCP is a similar example. It accepts requests for IP address from un-configured hosts. Then, based on any number of variables, including such things as (optionally) the name of the client requesting the address, or even based on a possible suggestion of an address by the client, it returns the IP address for that host. That too goes beyond the job of a layer 3 or a layer 4 protocol.
You have to rigorously interpret the tasks assigned to each of the ISO layers. Each one does its job.
There are odd exceptions to this rule, more or less "cheating," where for example a router, at layer 3, might inspect the headers of higher layer protocols in the datagram, to get some better ideas for routing decisions. But these odd exceptions have to be understood to be exceptions.
In IP, doesn't exist a clear separation between the upper layers (network, transport and application). But the reason of implement DNS, DHCP and some more services and applications (for example, AODV uses UDP ports and can be considered like a applications but it is also a routing protocol) it is purely practical.
Most of these protocols are arrived after the IP network was deployed, implements then like application modules allow to deploy easily in new computers, without the necessity of modify the IP protocol and, the core ip tower protocol implemented in the kernel of the operating systems. An implementation in the network layer it is true that offers better performance but increase the complexity protocol tower complicated the deployment. An implementation in the application layer also allow an easy deployment, it is possible to have machines with the new protocol and without the new protocol in the network, the machines without the protocol don't have all the functionalities but it can work. And also it simplify the deployment for the administrator, for example, include the DHCP in a new machine it is easy, it is only necessary to include a new program and configure operating system to start the program automatically. Implement the same functionality in a lower layer implies modification in the core of the operating system.
Moreover, DNS provides more than translation of domain names to IP addresses; enough to mention: service information for SIP (SRV records), and public key exchange for DomainKeys Identified Mail (TXT records).