In the Amazon RDS console:

In Parameter group details:
rdspg-lab-pg18Custom parameters for rdspg-lab-db (PostgreSQL 18)postgres18. The family must match the major version of the DB instance.Choose Create at the bottom of the page.

On the Custom tab:
rdspg-lab-pg18 appears with the family postgres18. A new group starts with the same values as the default group.
When you upgrade a DB instance to a new major version, you need a parameter group of the new family. This is why the major version upgrade in step 2.2 changed the parameter group of rdspg-lab-db to default.postgres18.
aws rds create-db-parameter-group \
--db-parameter-group-name rdspg-lab-pg18 \
--db-parameter-group-family postgres18 \
--description "Custom parameters for rdspg-lab-db (PostgreSQL 18)"