About parameter max_wal_size the documentation says that "Maximum size to let the WAL grow to between automatic WAL checkpoints." Is it correct? The size between automatic WAL checkpoints or the size of the whole pg_wal directory?
Reading on... "This is a soft limit; WAL size can exceed max_wal_size under special circumstances"
The database doesn't provide an option that would basically mean "make sure the wal directory doesn't get larger than X even if that means that it will become corrupted should it crash".
This setting is the indirect means to ensure that the WAL directory doesn't get too large by forcing a checkpoint thus allowing the corresponding WAL to be removed.