Tell me about that lost hour of my time, when a solution already exists on Ask Different.
Here is an AppleScript that I have tested on macOS Mojave 10.14.5 using your example .csv data. It will prompt you twice: 1) the .csv file, and 2) the folder containing your text files. After that, it is on autopilot and reads in the headerless .csv file, and proceeds to process each row, and move the files that exist into their designated folders. If the folder does not exist, it will make the folder and then move the file.
-- acsv.applescript
-- Prompt for headerless, .csv file and starting folder containing the files to process.
-- Reads each row of the CSV into a list, splits that list item into file and folder, and
-- moves the file into the appropriate folder. If a file does not exist, it skips that
-- row processing, and if the folder does not exist, it will make the folder.
-- Tested: macOS 10.14.5
-- Reference: https://discussions.apple.com/thread/250480620
-- VikingOSX, 2019-07-12, Apple Support Communities, No warranties expressed or implied.
property delim : {","}
property aDesktop : (path to desktop) as alias
property csvType : {"public.comma-separated-values-text", "public.delimited-values-text"}
set rowItems to {}
set afile to ""
set afolder to ""
set csvFile to (choose file with prompt "Select CSV file" of type csvType default location aDesktop without invisibles, multiple selections allowed and showing package contents)
set start_folder to (choose folder with prompt "Text File Folder" default location aDesktop without invisibles, multiple selections allowed and showing package contents)
set csvList to (read csvFile as text using delimiter linefeed) as list
tell application "Finder"
repeat with arow in csvList
repeat 1 times
-- use as many variables as you have columns in the CSV
set {afile, afolder} to my csvParse(arow, delim) as list
log afile
log afolder
try
set check_file to (start_folder & afile) as text as alias
on error
exit repeat
end try
try
set check_folder to (start_folder & afolder) as text as alias
on error
make new folder at start_folder with properties {name:afolder}
set check_folder to (start_folder & afolder) as text as alias
end try
move file check_file to folder check_folder
end repeat
end repeat
end tell
return
on csvParse(nrow, adelim)
-- replaces the commas in each row of the CSV with newlines
-- returns columns of data
return paragraphs of (do shell script "sed -E 's/,/\\'$'\\n/g' <<<" & nrow's quoted form)
end csvParse