Testing the Addition of the Pill Chemotherapy, Cabozantinib, to the Standard Immune Therapy Nivolumab Compared to Standard Chemotherapy for Non-small Cell Lung Cancer

This phase II trial compares cabozantinib alone and the combination of cabozantinib and nivolumab to standard chemotherapy in the treatment of patients with non-squamous non-small cell lung cancer (NSCLC). Cabozantinib may stop the growth of tumor cells by blocking some of the enzymes needed for cell growth. Immunotherapy with monoclonal antibodies, such as nivolumab, may help the body's immune system attack the cancer, and may interfere with the ability of tumor cells to grow and spread. Ramucirumab is a monoclonal antibody that may interfere with the ability of tumor cells to grow and spread. Chemotherapy drugs, such as docetaxel, gemcitabine hydrochloride, paclitaxel, and nab-paclitaxel, work in different ways to stop the growth of tumor cells, either by killing the cells, by stopping them from dividing, or by stopping them from spreading. Giving cabozantinib alone or in combination with nivolumab may be more effective than standard chemotherapy in treating patients with non-small cell lung cancer.

PRIMARY OBJECTIVE:

I. To determine whether cabozantinib alone, or the combination of nivolumab and cabozantinib, as compared to standard chemotherapy alone, extends progression-free survival (PFS) for this patient population with non squamous NSCLC.

SECONDARY OBJECTIVES:

I. To determine the overall survival for each arm of the trial. II. To evaluate the best overall radiographic response rate for each arm of the trial.

III. To evaluate and describe the toxicity profile of monotherapy with cabozantinib, and the combination of nivolumab and cabozantinib in this patient population with non-squamous NSCLC.

EXPLORATORY IMAGING OBJECTIVES:

I. To describe time point tumor response assessment, overall best response, progression-free survival and overall survival using the conventional Response Evaluation Criteria in Solid Tumors (RECIST) 1.1 criteria and the exploratory revised CHOI criteria with all measurements performed by the central review.

II. To compare the progression-free survival using the RECIST1.1 imaging response assessment measurements by site study personnel to those performed by central review.

EXPLORATORY CORRELATIVE OBJECTIVE:

I. To perform correlative biomarker research on tissue and blood biospecimens collected within this trial.

OUTLINE:

STEP 1: Patients are randomized to 1 of 3 arms.

ARM A: Patients receive cabozantinib S-malate orally (PO) once daily (QD). Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Patients may continue to receive therapy after investigator-assessed RECIST 1.1 defined progression, including stable clinical and performance status and have potential for continued clinical benefit.

ARM B: Patients receive cabozantinib S-malate PO QD and nivolumab intravenously (IV) over 30 minutes on day 1. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Patients may continue to receive therapy after investigator-assessed RECIST 1.1 defined progression, including stable clinical and performance status and have potential for continued clinical benefit.

ARM C: Patients receive ramucirumab IV over 30-60 minutes and docetaxel IV over 1 hour on day 1, or docetaxel IV over 1 hour on days 1 and 8, or gemcitabine hydrochloride IV on days 1 and 8, or paclitaxel IV over 3 hours on day 1, or nab-paclitaxel IV over 30 minutes on days 1 and 8. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity and at the discretion of the treating physician.

STEP 2: Patients in Arm C experiencing disease progression are assigned to Arm Z.

ARM Z: Patients receive cabozantinib S-malate PO QD and nivolumab IV over 30 minutes on day 1. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Patients may continue to receive therapy after investigator-assessed RECIST 1.1 defined progression, including stable clinical and performance status and have potential for continued clinical benefit.

Patients in all arms undergo echocardiogram (ECHO) as clinically indicated, computed tomography (CT) throughout the trial, and collection of blood on study.

After the completion of study treatment, patients are followed up every 3 months for up to 3 years.

Eligibility Criteria:
Inclusion Criteria:

* RANDOMIZATION (STEP 1): Patient must be \>= 18 years of age
* RANDOMIZATION (STEP 1): Patient must have pathologically confirmed non-squamous non-small cell lung carcinoma (NSCLC). Patients with NSCLC not otherwise specified (NOS) are eligible. Mixed tumors will be categorized by predominant cell type. If small cell elements are present, the patient is ineligible
* RANDOMIZATION (STEP 1): Patient must have metastatic stage IVA or IVB disease (includes M1a, M1b, and M1c), according to the 8th edition of the lung cancer TNM classification system. Recurrent metastatic NSCLC ineligible for curative therapy (in the treating investigator's opinion) is also allowed
* RANDOMIZATION (STEP 1): Patient's tumor must be known negative for EGFR tyrosine kinase inhibitor (TKI) sensitizing mutations (for example at a minimum, negative for EGFR Exon 19 deletions, EGFR exon 20 insertions, and Exon 21 L858R, L861Q mutations ) AND negative for ALK gene rearrangements (by fluorescence in situ hybridization \[FISH\], next generation sequencing \[NGS\], or immunohistochemistry \[IHC\]) by routine Clinical Laboratory Improvement Amendments (CLIA)- or Food and Drug Administration (FDA)-certified clinical testing methods. CLIA or FDA approved circulating tumor deoxyribonucleic acid (DNA) testing is acceptable as an alternative to tissue testing
* RANDOMIZATION (STEP 1): Patient must have radiographic and/or clinical progression (per local investigator assessment) following one, but only one, line of platinum-based chemotherapy AND one, but only one, line of prior checkpoint inhibitor (anti-PD-1 or PD-L1) immunotherapy, either concurrently or sequentially in either order. A minimum of two doses of prior immunotherapy is required. Only one prior line of therapy is allowed if patients received chemotherapy and immunotherapy together (patients may not receive subsequent single agent chemotherapy), and greater than two prior lines of therapy are not allowed.

  * NOTE: Lines of therapy are defined by clinical or radiographic progression. For patients with recurrent metastatic NSCLC following treatment for stage 1-3 NSCLC, platinum-based chemotherapy received within 12 months of recurrence and/or immunotherapy received within 6 months of recurrence will meet the requirement for prior chemotherapy and/or immunotherapy but subsequent receipt of more immunotherapy and/or platinum-based chemotherapy is also allowed.
  * NOTE: Prior anti-VEGF antibody therapy (ie bevacizumab) is allowed. Prior ipilimumab, or investigational agents not excluded below, in combination with the required prior therapies above are allowed.
  * NOTE: Prior receipt of one or two lines of targeted therapy for ROS1, RET, MET, BRAF, ERBB2/HER2, or KRAS G12C positive NSCLC is allowed and will not count toward the line of therapy limit. However, progression is still required after chemotherapy and immunotherapy as above. Patients with ROS1, RET, MET positive NSCLC are strongly encouraged to get appropriate targeted therapy (such as crizotinib, entrectinib, lorlatinib, selpercatinib, pralsetinib, capmatinib, tepotinib, or another investigational, off-label, or approved agent directed against ROS1, RET, or MET positive NSCLC) prior to participation and will be stratified.
  * NOTE: No prior predominantly VEGFR directed TKI therapy (such as cabozantinib, lenvatinib, or sitravantinib) is allowed, except for the agents named above.
* RANDOMIZATION (STEP 1): The investigator must document the intended chemotherapy regimen should their patient be randomized to Arm C (docetaxel and ramucirumab, OR single agent chemotherapy - docetaxel, gemcitabine, paclitaxel, nab-paclitaxel). The patient must not have received the selected chemotherapy agent previously for metastatic disease
* RANDOMIZATION (STEP 1): Any prior chemotherapy (based on administration schedule) must have been completed in greater than or equal to the following times prior to randomization:

  * FDA approved targeted oral therapy must be completed \>= 1 week prior
  * Chemotherapy and/or immunotherapy must be completed \>= 2 weeks prior
  * Prior investigational agents must be completed \>= 4 weeks prior.
* RANDOMIZATION (STEP 1): Prior radiation therapy is allowed with a 2 week washout prior to randomization. Patient must not receive any systemic treatment with radionuclides within 6 weeks prior to randomization. Patient must have no clinically relevant ongoing complication from prior radiation therapy
* RANDOMIZATION (STEP 1): Patients with a prior or concurrent malignancy whose natural history or treatment does not have the potential to interfere with the safety or efficacy assessment of the investigational regimen (in the opinion of the treating physician) are eligible for this trial
* RANDOMIZATION (STEP 1): Patients with known history or current symptoms of cardiac disease, or history of treatment with cardiotoxic agents (such as anthracycline or HER2-directed antibody therapy, but not prior checkpoint inhibitor therapy), must have a clinical risk assessment of cardiac function using the New York Heart Association Functional Classification. To be eligible for this trial, patients must be class 2B or better
* RANDOMIZATION (STEP 1): Patient must have Eastern Cooperative Oncology Group (ECOG) performance status 0-1
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must have met the eligibility criteria outlined above
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must have measurable disease as defined by RECIST v1.1. Measurements must be obtained within 4 weeks prior to randomization/registration
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must have recovered to equal to or less than grade 1 toxicities related to prior treatment, unless toxicities are clinically non significant and/or stable on supportive therapy (as determined by the treating physician)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Absolute neutrophil count \>= 1,500/mcL (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Platelets \>= 100,000/mcL (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Hemoglobin \>= 9 g/dL (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Total bilirubin =\< 1.5 x institutional upper limit of normal (ULN) (for patients with Gilbert's disease total bilirubin must be =\< 3 x ULN) (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Aspartate aminotransferase (AST)(serum glutamic oxaloacetic transaminase \[SGOT\]) and alanine aminotransferase (ALT)(serum glutamate pyruvate transaminase \[SGPT\]) =\< 2.5 x ULN (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Creatinine =\< 1.5 x ULN OR calculated (Cockcroft-Gault formula) or measured creatinine clearance \>= 50 mL/min/1.73m\^2 (normalized to body surface area \[BSA\]) for patients with creatinine levels greater than 1.5 times the institutional normal creatinine =\< 1.5 X ULN or creatinine clearance \>= 50ml/min/1.73m\^2 (obtained within 2 weeks prior to randomization)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not be pregnant or breast-feeding due to the unknown effects of cabozantinib and nivolumab on human development and for the potential risk for adverse events in nursing infants with the treatment regimens being used.

  * All patients of childbearing potential must have a blood test or urine study within 14 days prior to randomization/registration to rule out pregnancy.
  * A patient of childbearing potential is anyone, regardless of sexual orientation or whether they have undergone tubal ligation, who meets the following criteria: 1) has achieved menarche at some point, 2) has not undergone a hysterectomy or bilateral oophorectomy; or 3) has not been naturally postmenopausal (amenorrhea following cancer therapy does not rule out childbearing potential) for at least 24 consecutive months (i.e., has had menses at any time in the preceding 24 consecutive months).
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not expect to conceive or father children by using accepted and effective method(s) of contraception or by abstaining from sexual intercourse for the duration of their participation in the study and for 6 months after completion of treatment on the study
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have clinically significant gastrointestinal bleeding within 6 months prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have pulmonary hemorrhage or hemoptysis of \>= 0.5 teaspoon (2.5 mL) of red blood within 3 months prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have active drug induced pneumonitis within 3 months prior to randomization. Prior immune mediated pneumonitis of grade 3 or 4 are not eligible regardless of time window
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have current radiographic evidence of tumor invading major blood vessel, evidence of tumor cavitation \> 1 cm, evidence of tumor invading the gastrointestinal (GI) tract (esophagus, stomach, small or large bowel, rectum or anus), or evidence of endotracheal or mainstem endobronchial tumor
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have peptic ulcer disease, known malabsorption syndrome, bowel obstruction or gastric outlet obstruction within 3 months prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have abdominal fistula, GI perforation, or intra-abdominal abscess within 6 months prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have grade 3 or greater infection, or infection requiring intravenous systemic treatment within 14 days prior to randomization. Patients must be off antibiotics at the time of randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have serious non-healing wound/ulcer/bone fracture within 28 days prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have history of organ transplant
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have concurrent symptomatic untreated hypothyroidism
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have history of major surgery within 3 months prior to randomization, minor surgery within 28 days prior to randomization, other minor procedures within 7 days prior to randomization, or clinically relevant ongoing complications from prior procedures
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have concurrent uncontrolled hypertension defined as sustained blood pressure (BP) \> 160 mm Hg systolic, or \> 100 mm Hg diastolic despite optimal antihypertensive treatment
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have unstable angina pectoris, clinically-significant cardiac arrhythmias, stroke (including transient ischemic attack \[TIA\]), or myocardial infarction within 6 months prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients must not have a diagnosis of deep vein thrombosis/pulmonary embolism (DVT/PE) within 6 months of randomization unless stable, asymptomatic, and treated with low-molecular-weight heparin (LMWH) or a permitted oral anticoagulant for at least 7 days before randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must not be receiving anticoagulants (i.e., warfarin, aspirin, clopidogrel) except:

  * Prophylactic use of low-dose aspirin (100 mg po daily or less) and/or low dose molecular weight heparin (LMWH) is permitted.
  * Therapeutic doses of low dose molecular weight heparin (LMWH) or specified direct factor Xa inhibitors rivaroxaban, edoxaban, or apixaban are allowed in patients without untreated brain metastases who are on a stable dose 7 days prior to study randomization, and without clinically significant hemorrhagic complications from the anticoagulation regimen or the tumor
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must not receive strong CYP3A4 inducers (e.g., dexamethasone (\> 1 mg daily dosing), phenytoin, carbamazepine, rifampin, rifabutin, rifapentine, phenobarbital, and St. John's Wort) within 7 days prior to randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must have corrected QT interval calculated by the Fridericia formula (QTcF) =\< 500 msec within 28 days prior to Step 1 randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must be able to swallow tablets
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must not be on continuous systemic treatment with corticosteroids (\> 10 mg daily prednisone equivalents) or other immunosuppressive medications within 7 days prior to randomization, with the following exceptions:

  * Inhaled or topical steroids and adrenal replacement doses =\< 10 mg daily prednisone equivalents are permitted in the absence of active autoimmune disease.
  * Patients are permitted to use topical, ocular, intra-articular, intranasal, and inhalational corticosteroids (with minimal systemic absorption).
  * Physiologic replacement doses of systemic corticosteroids are permitted, if \< 10 mg/day prednisone equivalents. A brief course of corticosteroids for prophylaxis (e.g., contrast dye allergy) or for treatment of non-autoimmune conditions (e.g., delayed-type hypersensitivity reaction caused by contact allergen) is permitted
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients with brain metastases are eligible as follows:

  * Previously treated brain metastases must have been treated with radiation \> 2 weeks prior to randomization or surgery \> 3 months prior to randomization OR
  * Untreated (active) brain metastases are allowed if they are clinically asymptomatic, \< 1 cm, non-hemorrhagic, the patient is not on systemic anticoagulation, and the investigator believes that central nervous system (CNS) specific treatment is unlikely to be required during the first 3 months of study treatment.
  * NOTE: Symptomatic leptomeningeal disease is NOT allowed
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must not have known active autoimmune disease or known history of autoimmune disease for which recurrence may affect vital organ function or require immune suppressive treatment including systemic corticosteroids (e.g., immune-related neurologic disease, multiple sclerosis, autoimmune neuropathy, Guillain-Barre syndrome, etc.).
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients with known history of human immunodeficiency virus (HIV)-infection must be on effective anti-retroviral therapy with undetectable viral load within 6 months of randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients with known history of chronic hepatitis B virus (HBV) infection must have undetectable HBV viral at time of randomization (suppressive therapy is allowed, if indicated)
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patients with a known history of hepatitis C virus (HCV) infection must have been treated and cured. For patients with HCV infection who are currently on treatment, they are eligible if they have an undetectable HCV viral load at time of randomization
* RANDOMIZATION (STEP 1 - ALL TREATMENT ARMS): Patient must not have had any prior allergic reaction or hypersensitivity to study drug components or related drugs (multitargeted small molecule tyrosine kinase inhibitors or checkpoint inhibitor monoclonal antibodies)
* STEP 2 (CROSSOVER ARM Z): Patient must have met all eligibility requirements for Step 1 at time of registration to Step 1 to be eligible for Step 2
* STEP 2 (CROSSOVER ARM Z): Patient must have radiographic progressive disease per RECIST criteria after \>= 2 cycles of therapy on Arm C. The scan showing progression must be completed within 6 weeks prior to Step 2 registration
* STEP 2 (CROSSOVER ARM Z): Patient must not have intervening anticancer treatment or major surgical procedure(s) between Step 1 and Step 2, except palliative radiation which was completed \>= 1 week prior to registration to Step 2
* STEP 2 (CROSSOVER ARM Z): Patient may not have central nervous system progression, but patients with stable CNS disease are allowed
* STEP 2 (CROSSOVER ARM Z): Patient must have an ECOG performance status 0-2
* STEP 2 (CROSSOVER ARM Z): Patient must have recovered to equal to or less than grade 1 toxicities related to prior treatment, unless the adverse event(s) are clinically non significant and/or stable on supportive therapy (as determined by the treating physician)
* STEP 2 (CROSSOVER ARM Z): Absolute neutrophil count \>= 1,500/mcL (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): Platelets \>= 100,000/mcL (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): Hemoglobin \>= 9 g/dL (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): Total bilirubin =\< 1.5 x institutional ULN (for patients with Gilbert's disease total bilirubin must be =\< 3 x ULN) (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): AST(SGOT) and ALT(SGPT) =\< 2.5 x ULN (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): Creatinine =\< 1.5 x ULN OR calculated (Cockcroft-Gault formula) or measured creatinine clearance \>= 50 mL/min/1.73m\^2 (normalized to BSA) for patients with creatinine levels greater than 1.5 times the institutional normal creatinine =\< 1.5 X ULN or creatinine clearance \>= 50ml/min/1.73m\^2 (obtained within 2 weeks prior to registration to Step 2)
* STEP 2 (CROSSOVER ARM Z): Patient must have corrected QT interval calculated by the Fridericia formula (QTcF) =\< 500 ms within 28 days prior to Step 2 registration
* STEP 2 (CROSSOVER ARM Z): Patient must not have any intercurrent illness or disease complication that the investigator believes would limit the ability to safely tolerate the combination of cabozantinib and nivolumab
* STEP 2 (CROSSOVER ARM Z): Patient must not be pregnant or breast-feeding due to the unknown effects of cabozantinib and nivolumab on human development and for the potential risk for adverse events in nursing infants with the treatment regimens being used.

  * All patients of childbearing potential must have a blood test or urine study within 14 days prior to registration to Step 2 to rule out pregnancy.
  * A patient of childbearing potential is anyone, regardless of sexual orientation or whether they have undergone tubal ligation, who meets the following criteria: 1) has achieved menarche at some point, 2) has not undergone a hysterectomy or bilateral oophorectomy; or 3) has not been naturally postmenopausal (amenorrhea following cancer therapy does not rule out childbearing potential) for at least 24 consecutive months (i.e., has had menses at any time in the preceding 24 consecutive months).
* STEP 2 (CROSSOVER ARM Z): Patients must not expect to conceive or father children by using accepted and effective method(s) of contraception or by abstaining from sexual intercourse for the duration of their participation in the study and for 6 months after completion of treatment on the study