IPsec was originally planned as part of the next-generation IP (IPv6), but security quickly became very important, and IPsec was designed as the Internet security protocol for both IPv4 and IPv6 (RFC 1825, Security Architecture for the Internet Protocol, later obsoleted by RFC 2401, Security Architecture for the Internet Protocol, later obsoleted by RFC 4301, Security Architecture for the Internet Protocol). Since IPv4 was already defined, IPsec is basically bolted on (IPSec packets are payload), but IPv6 was still being defined, and IPsec is a integral part of IPv6. From the beginning, IPv6 has had the AH and ESP extension headers, something not really possible with IPv4.
It took longer than originally planned for IPv6 to start being used, and nodes began to use IPsec in applications for IPv4. The way applications use IPsec with IPv4 (simply as payload for IPv4 or IPv6 packets, or as tunnels where the entire packet is encrypted as payload of the encapsulating packet) can also be used with IPv6; it is really network protocol independent.
As IPv6 came along, the way IPsec is implemented has not really changed, and the implementation using extension headers hasn't really materialized. One exception is OSPFv3. As IPv6 overtakes IPv4, we may see the way IPsec (or its descendants) used move to IPv6 packet headers, or it may remain implemented as it is today.