Agreed. The proposed solution simply addresses a single symptom of what may be a misunderstanding about how the system works (i.e., that an object can only have a single owner, and, each privilege is specific to an object and does not confer any implied privileges on container objects - schemas and databases namely).
If there is a suggestion to improve the core misunderstandings that is something to consider. Ideally in a central place about permissions in general and not in the specific ALTER DATABASE command.
Given that the default behavior of PostgreSQL is to grant CONNECT via PUBLIC, removing ownership of a database from a role does not, by default, remove their connect privilege.
David J.