The problem doesn't occur during the read. It happens when you attempt to expand the value of %%A
and delayed expansion is enabled. It's a problem because delayed expansion occurs after FOR variable expansion. The solution is to toggle delayed expansion on and off as needed.
@echo off
setlocal DisableDelayedExpansion
set SEARCH=a
set REPLACE=x
set FILE=test.txt
for /f "delims=" %%A in (%FILE%) DO (
set line=%%A
setlocal enableDelayedExpansion
set line=!line:%SEARCH%=%REPLACE%!
echo !line!
endlocal
)