The query builder does not have a limit, limits are used when the query is used, it is not a thing of the query itself.
The most natural way is to just not traverse the foundset beyond the maxReturnedRows.
Since a foundset is loading in a lazy way, the other records and pks are never read from the database.
If this is not feasible, you can read all pks (with limit) in a dataset and load the foundset with those.
Note that the pks are loaded twice from the database in that case.
var dataset = databaseManager.getDataSetByQuery(query, maxReturnedRows)
foundset.loadRecords(dataset)