"does GRE have a layer 4 header?"
Hmm, that's an interesting question.
Like ICMP, IGMP, TCP, UDP and many others, GRE is a defined protocol for IP. It like the others IP protocols, depends on IP, the L3 layer, to deliver the GRE packets.
Once a GRE packet is delivered, it's unwrapped to provide another IP packet. I.e. it's a bit more/different stack processing from OSI L3 packet delivery, alone, across a routed network, yet less than some other IP protocols considered full L4 protocols, like TCP or UDP using/having "port numbers" (which GRE does not).
However, if you equate GRE's encapsulated IP addresses to UDP ports numbers (both accomplish similar goals), and/or consider GRE RFC 2890 header fields (key field, sequence field), it's getting somewhat like other IP L4 transport protocols (i.e. end-to-end considerations beyond just what L3 considers).
In my (not so humble [laugh]) opinion, I would classify GRE, in the OSI model, as either 3+ or something like 3.5.
BTW, the Wiki article for the OSI model has, within this section Wiki OSI model L4, this statement "While Generic Routing Encapsulation (GRE) might seem to be a network-layer protocol, if the encapsulation of the payload takes place only at the endpoint, GRE becomes closer to a transport protocol that uses IP headers but contains complete Layer 2 frames or Layer 3 packets to deliver to the endpoint. L2TP carries PPP frames inside transport segments."
Personally, I don't consider Wiki articles to be totally authoritative, but I do find it interesting that GRE has a special mention. (NB: I checked Wiki after noting my thinking, above.)