but it does also pull in tracks from other folders.
This is only possible, if you have have albums from the metal folder with the same name in other folders. In this case you could try this (assuming that all selected album names are distinct):
WITH Albums AS (
SELECT album, max(substr(path,1,10)) path
FROM MediaLibrary
WHERE path LIKE 'D:\Metal\%' AND substr(path, 10, 1) > 'M'
GROUP BY album
HAVING avg(rating)>3 OR min(rating)=''
)
INSERT INTO Playlist_Updatable(metadb_handle,playlist_name)
SELECT a.metadb_handle, 'SQL_>M'
FROM MediaLibrary a JOIN Albums ON a.album = Albums.album AND a.path LIKE Albums.path||'%'