Here's what you started with.
CREATE TABLE medication (
"id" INTEGER NOT NULL, -- You don't need this.
"therapy_id" INTEGER NOT NULL,
"day" INTEGER NOT NULL,
"revision" INTEGER NOT NULL,
"substance" VARCHAR(100),
"dosage" VARCHAR(50),
PRIMARY KEY (id), -- Drop this.
FOREIGN KEY(therapy_id, day, revision)
REFERENCES day (therapy_id, day, revision), -- Ok, but should be PK.
FOREIGN KEY(therapy_id) REFERENCES therapy (id) -- You don't need this.
);
The column "id" serves no useful purpose, and has instead convinced you that you don't need a unique constraint on the real key: {therapy_id, day, revision}. Replace the useless primary key constraint on "id" with a primary key constraint on {therapy_id, day, revision}. Drop the last foreign key constraint. You know "therapy_id" will reference an existing row, because the foreign key constraint in the table "day" requires it.
That leaves us with this.
CREATE TABLE medication (
"therapy_id" INTEGER NOT NULL,
"day" INTEGER NOT NULL,
"revision" INTEGER NOT NULL,
"substance" VARCHAR(100),
"dosage" VARCHAR(50),
PRIMARY KEY (therapy_id, day, revision),
FOREIGN KEY(therapy_id, day, revision)
REFERENCES day (therapy_id, day, revision)
);
It troubles me that "substance" and "dosage" are nullable. Think about that a little.