Can commercial pilots (e.g. 737 and 737 Max) program departures into their on-board GPS navigation system for the first portion of a flight that doesn't have specific RNAV procedures?
A Boeing 737 uses a Flight Management System (FMS, see this question for details: What's the difference between FMS and FMC?). This FMS takes inputs from multiple navigation sources/sensors, including inertial, radio, and GPS. One part of this system is the CDU (Control and Display Unit, actually there are two installed), which is one of the interfaces to the FMS:
(source, this is from a simulator, real one looks similar)
On the page in the image above, the departure runways and SIDs for EDDK are shown as an example. The pilots can select the departure procedure that was assigned to them by ATC. This assumes the flight is conducted under Instrument Flight Rules (IFR), but since you asked about commercial operations this will almost certainly be the case.
A departure procedure without any specific RNAV waypoints (e.g. fly runway heading, then radar vectors) will still be selectable in the CDU. An item VECTORS will be displayed on the LEGS page between the departure runway and the first enroute waypoint. Once ATC clears you direct to a waypoint, the CDU can be easily updated by moving this waypoint to the top.
It is also possible to manually enter waypoints into the LEGS page if a pilot chooses to do so. The 737 CDU allows creating pseudo waypoints e.g. by giving a reference waypoint, a distance in NM and a course. This way, a more accurate route can be shown on the Navigation Display (ND). However, when getting radar vectors from ATC it is more likely the pilots will fly using HDG SEL (Heading Select) rather than following waypoints programmed into the FMS using LNAV (Lateral Navigation).
I am not familiar with the 737, but GPS systems commonly in use by general aviation for the last two decades will allow pilots to load a published departure or approach procedure as long as it is in the unit's database. And if not, as long as the waypoints were in the database you could create it manually. It doesn't take a big stretch to presume that modern airliners have the same capability.