HNSW supports M and ef_construction at index create time (see here) and they are exposed as session variables for pgvector (see here).
Currently, MariaDB lets you set M but does not let you set ef_construction. Support was there in this PR (also see here) but I don't know what happened since then.