Interesting View-Point , though there are certain logical issues like what you encountered.
"Can the differential be unitless while the variable have an unit in integration?" : No
We have $\Delta x$ tracking the small change in $x$. That lets us calculate $x + \Delta x$
When volume $v$ in $m^3$ varies , the small change $\Delta v$ must be in $m^3$ , which will let us calculate $v + \Delta v$ in $m^3$
When time $t$ in $s$ varies , the small change must be in $s$ , which will let us calculate $t + \Delta t$ in $s$
In Case the units do not match , such calculations will be meaningless.In Case the units do not match , such calculations will be meaningless : We can not add a number with units to a number without units.
We can avoid that issue with 2 ways.
(1) Both have same units :
$x$ & $\Delta x$ have the same units like $m^3$ , $s$ , $\cdots$
That will let us add $x$ & $\Delta x$
While certain things will work out , it will complicate calculations like Series $1+x+x^2+x^3\cdots=1/(1-x)$
That complication can be resolved , though more work is required.
Basically , we have to ensure that there are certain co-efficients like $a_1x+x_2x^2+a_2x^3\cdots$ where these co-efficients (which should have the necessary units) will convert all the terms to some common unit , letting us add the terms.
Your Integral can use the same thinking :
In your Integral , $x$ & $\Delta x$ will have same units , while the "Density" function must be in reciprocal units.
Hence , the over-all units will be consistent : $E(x)$ & $x$ will have same units.
(2) Both are unitless :
Alternate way is to take all variables to not have units. When we want to calculate area or volume or what-ever , we remove that units from the variables , then we make the calculations , then we add the units back.
There are no complication with calculations like Series $1+x+x^2+x^3\cdots=1/(1-x)$
Your Integral can use the same thinking :
All terms $x$ , $\Delta x$ , $f(x)$ have no units.
Make the calculations , then introduce the relevant units when required.
This way lets us talk about arbitrary terms like $E(x+x^2)$ , $E(x+1/x)$ , $E(\sqrt{x}+e^x)$ , for example , without losing consistency.
Both ways are common & used where-ever appropriate.